home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / cdrom / mscdex21.zip / MSCDEX21.DOC < prev   
Text File  |  1992-05-30  |  133KB  |  2,768 lines

  1. Microsoft MS-DOS CD-ROM Extensions 2.1
  2.  
  3. Product Overview Version 2.10 Beta
  4.  
  5. The Microsoft MS-DOS CD-ROM Extensions are an extension to the MS-DOS
  6. operating system which permit reading CD-ROM disks which conform to both the
  7. High Sierra May 28th format and the ISO-9660 version of the High Sierra
  8. format. The CD-ROM disc appears just like a magnetic disk to the user and to
  9. applications software, ensuring compatibility with current software.
  10. Microsoft, as creator of the MS-DOS operating system, is able to ensure
  11. compatibility with MS-DOS.
  12.  
  13.  
  14. Product Components
  15.  
  16. The complete product consists of a program supplied by Microsoft and of a
  17. hardware-dependent device driver supplied by an OEM customer. The program
  18. supplied by Microsoft is named MSCDEX.EXE. Technical documentation as well
  19. as a sample driver are also supplied by Microsoft.
  20.  
  21.  
  22. Technical Overview
  23.  
  24. Characteristics
  25.  
  26.   ■ Requires MS-DOS 3.1 or higher or 4.0 (or PC-DOS 3.1 or higher or 4.0)
  27.   ■ Implements the High Sierra May 28th format and ISO-9660
  28.   ■ Requires a hardware-dependent device driver
  29.  
  30. This product uses the Microsoft Networks interface to MS-DOS so it requires
  31. MS-DOS version 3.1 or higher or 4.0.  MS-DOS 3.1 virtualizes the interface
  32. to drives. The entire CD-ROM (potentially all 660 megabytes) will appear to
  33. applications as a single MS-DOS drive letter. The extensions overcome the 32
  34. megabyte disk size limitation in MS-DOS. The Microsoft MS-DOS CD-ROM
  35. Extensions provide a high degree of compatibility with applications that
  36. depend on MS-DOS standard interfaces. Applications can access files on the
  37. CD-ROM just as they would on any disk.
  38.  
  39. The program MSCDEX.EXE is an installable file system driver implemented as a
  40. terminate and stay resident module. The user will load this program upon
  41. booting the computer using AUTOEXEC.BAT. The hardware-dependent device
  42. driver implements basic functions to read the CD-ROM disc and is loaded with
  43. the MS-DOS CONFIG.SYS file.
  44.  
  45. The Microsoft MS-DOS CD-ROM Extensions implement both the May 28th High
  46. Sierra file format and the ISO-9660 version of that standard. All features
  47. defined in May 28th proposal for Level 1 are implemented. In addition the
  48. following are implemented:
  49.  
  50. Features Beyond High Sierra Level 1
  51.  
  52.   ■  Support for Interleaved Files
  53.   ■  Support for 31 Character File Names when possible through truncation
  54.   ■  Support for Hidden Files
  55.   ■  Support for Access to VTOC
  56.   ■  Ignores Higher Level Files and Functions when present on the disk:
  57.      -  Associated Files
  58.      -  Protection Bits
  59.      -  Record Bits
  60.      -  File Version Numbers
  61.  
  62.   ■ Support for shift-JIS Kanji (Japanese character) filenames
  63.  
  64.  
  65. Hardware-Dependent Device Driver
  66.  
  67. This product requires a hardware-dependent device driver that interfaces to
  68. a specific OEM drive or drives. A detailed specification for the device
  69. driver as well as a sample driver are included. The driver implements the
  70. basic functions of reading the CD-ROM and is installed using the DOS
  71. CONFIG.SYS conventions. A minimum set of functions that allow reading the
  72. CD-ROM disc are required to be in the device driver; there are optional
  73. additional functions which provide increased performance when the CD-ROM
  74. drive and controller can provide additional functions and these are
  75. implemented in the driver. These functions are detailed in the Microsoft MS-
  76. DOS CD-ROM Extensions Hardware-Dependent Device Driver Specification.
  77.  
  78. The device driver is written by the OEM customer for the MS-DOS CD-ROM
  79. Extensions. Development of the device driver is estimated to take
  80. approximately 1-3 man-months. This estimate assumes an engineer experienced
  81. in 8086 assembler programming and familiar with MS-DOS and the CD-ROM drive
  82. hardware. If a previous device driver has already been written, less time
  83. will probably be needed to implement the driver for the Microsoft MS-DOS CD-
  84. ROM extensions. There are third party companies who will write the hardware-
  85. dependent device drivers on a consulting basis.
  86.  
  87.  
  88. Licensing the Microsoft MS-DOS CD-ROM Extensions
  89.  
  90. Microsoft will license the MS-DOS CD-ROM Extensions to manufacturers and
  91. marketers of CD-ROM disc drives. The license agreement will allow the use of
  92. the product on a personal computer to which a licensed disc drive is
  93. attached. Developers of CD-ROM disks will not need to acquire any license or
  94. pay any royalty in order to develop or sell CD-ROM discs, and will not be
  95. entitled to distribute the MS-DOS CD-ROM Extensions. The end user will
  96. purchase the driver from drive manufacturer or marketer, not the CD-ROM disc
  97. developer.
  98.  
  99. The Microsoft MS-DOS CD-ROM Extensions will be delivered to licensees on a
  100. 5 1/4" MS-DOS diskette. Licensees are expected to distribute the Extensions
  101. to their customers on a floppy diskette containing both MSCDEX.EXE and the
  102. hardware-dependent device driver written by the licensee. The floppy would
  103. be included in the package containing the CD-ROM drive.
  104.  
  105.  
  106. Creating CD-ROM Disks in the High Sierra Format
  107.  
  108. The Microsoft MS-DOS CD-ROM Extensions provides for reading CD-ROM discs in
  109. the High Sierra/ISO-9660 format on MS-DOS computers. They do not create CD-
  110. ROM disks in the High Sierra/ISO-9660 format. Microsoft does not manufacture
  111. CD-ROM discs, nor provide pre-mastering services. Third party companies can
  112. create CD-ROM discs in the High Sierra/ISO-9660 format and provide other
  113. pre-mastering services. Microsoft can supply a list of companies providing
  114. or planning to provide these services upon request.
  115.  
  116. Software developers do not need the MS-DOS CD-ROM Extensions in order to
  117. create either applications software which reads CD-ROM discs, or to create
  118. CD-ROM discs. Once the software is ready and a disc has been pressed,
  119. developers will want a copy of the Extensions for testing; however, they are
  120. not needed in order to start development.
  121.  
  122. Software developers need do nothing special for accessing CD-ROM discs; they
  123. issue the same MS-DOS OPEN and READ calls as for opening any magnetic disks.
  124. Programmers can develop CD-ROM applications using standard MS-DOS tools.
  125. They need to be aware that they cannot create any temporary files or write
  126. any files in either the directory or on the entire CD-ROM disc. Software
  127. developers will want to minimize the number of seeks to the CD-ROM because
  128. of the comparatively long seek times of CD-ROM drives.
  129.  
  130. ████████████████████████████████████████████████████████████████████████████
  131.  
  132. Hardware-Dependent Device Driver Specification
  133.  
  134. Intent
  135.  
  136. This document (Document Number: 000080010-100-O00-1186) describes the CD-ROM
  137. hardware-dependent device driver and its interface with MSCDEX.EXE, the MS-
  138. DOS CD-ROM Extensions resident program. Differences between CD-ROM drives
  139. and hard- or floppy-disk drives account for the differences in this device
  140. driver specification from the normal MS-DOS block and character device
  141. driver specification. The chapters on device drivers in the MS-DOS
  142. Programmer's Reference Manual (MS-PRM) provide more information.
  143.  
  144. The MS-DOS operating system reads CONFIG.SYS and installs the device.
  145. MSCDEX.EXE performs an open system call on the device driver name in order
  146. to communicate with it and uses an IOCTL call to ask the device driver for
  147. the address of its device header. From the device header address, MSCDEX.EXE
  148. locates the device driver's interrupt and strategy routines. After that, all
  149. requests the device driver receives come directly from MSCDEX.EXE, not MS-
  150. DOS. To avoid reentrancy problems and allow MSCDEX to monitor all media
  151. changes, all other applications that wish to communicate directly with CD-
  152. ROM device drivers should do so through the Send Device Driver Request INT
  153. 2Fh function 10h. MSCDEX.EXE interfaces with MS-DOS so that normal requests
  154. for I/O with files on a CD-ROM drive down to the MS-DOS INT 21h service
  155. layer will work just as they would for a normal MS-DOS device.
  156.  
  157.  
  158. Installation
  159.  
  160. The device driver will be installed in the same way as any other device with
  161. an entry in CONFIG.SYS. The syntax is:
  162.  
  163.   DEVICE=<filename> /D:<device_name> /N:<number of drives>
  164.  
  165. The following are examples:
  166.  
  167.   DEVICE=HITACHI.SYS /D:MSCD001 /D:MSCD002
  168.  
  169.   DEVICE=SONY.SYS    /D:MSCD003 /N:2
  170.  
  171.  
  172. The arguments will be the character device names that will be used on the
  173. command line when starting MSCDEX.EXE so that it can find and communicate
  174. with the device driver.
  175.  
  176. A device driver may support one or more physical drives or logical disks.
  177. This may be done by having multiple device headers in the device driver file
  178. (in which case it will be necessary to have more than one device_name on the
  179. command line - one for each device header; see the HITACHI.SYS example
  180. above) or through the use of subunits. Each disk handled by a device driver
  181. that supports multiple disks using subunits is addressed by the subunit
  182. field of the request header when a request is made for that disk. A device
  183. driver that supports more than one disk can share code and data instead of
  184. requiring separate device drivers for each disk. A "jukebox" CD-ROM system
  185. would be an example of a CD-ROM device that might wish to support more than
  186. one drive or a disk pack using a single device driver.
  187.  
  188. Device drivers that use multiple subunits should use the optional switch
  189. /n:<number of drives> to say how many drives are present. If not present,
  190. the default number of drives is 1. If the driver can tell how many drives
  191. are installed without a command line switch, then this argument is not
  192. necessary. Unless there are special considerations, it is better practice to
  193. support multiple drives using subunits than to have multiple device headers
  194. in the same device driver file.
  195.  
  196.  
  197. Device Header
  198.  
  199. The device header is an extension to what is described in the MS-PRM.
  200.  
  201. DevHdr    DD   -1        ; Ptr to next driver in file or -1 if last driver
  202.           DW   ?         ; Device attributes
  203.           DW   ?         ; Device strategy entry point
  204.           DW   ?         ; Device interrupt entry point
  205.           DB   8 dup (?) ; Character device name field
  206.           DW   0         ; Reserved
  207.           DB   0         ; Drive letter
  208.           DB   ?         ; Number of units
  209.  
  210. The following are the device attributes for MSCDEX.EXE device drivers:
  211.  
  212.   Bit 15         1       - Character device
  213.   Bit 14         1       - IOCTL supported
  214.   Bit 13         0       - Output 'till  busy
  215.   Bit 12         0       - Reserved
  216.   Bit 11         1       - OPEN/CLOSE/RM supported
  217.   Bit 10-4       0       - Reserved
  218.   Bit  3         0       - Dev is CLOCK
  219.   Bit  2         0       - Dev is NUL
  220.   Bit  1         0       - Dev is STO
  221.   Bit  0         0       - Dev is STI
  222.  
  223. MSCDEX.EXE device drivers will be character devices that understand IOCTL
  224. calls and handle OPEN/CLOSE/RM calls.
  225.  
  226. The drive letter field is a read-only field for the device driver and is
  227. initialized to 0. The field is for MSCDEX.EXE to use when it assigns the
  228. device driver to a drive letter (A = 1, B = 2...Z = 26). It should never be
  229. modified by the device driver. For drivers that support more than one unit,
  230. the drive letter will indicate the first unit, and each successive unit is
  231. assigned the next higher drive letter. For example, if the device driver has
  232. four units defined (0-3), it requires four drive letters. The position of
  233. the driver in the list of all drivers determines which units correspond to
  234. which drive letters. If driver ALPHA is the first driver in the device list,
  235. and it defines 4 units (0-3), they will be A, B, C, and D. If BETA is the
  236. second driver and defines three units (0-2), they will be E, F, and G, and
  237. so on. The theoretical limit to the number of drive letters is 63, but it
  238. should be noted that the device installation code will not allow the
  239. installation of a device if it would result in a drive letter > 'Z' (5Ah).
  240. All block device drivers present in the standard resident BIOS will be
  241. placed ahead of installable device drivers in the list.
  242.  
  243. ───────────────────────────────────────────────────────────────────────────
  244. NOTE:
  245.   It is important that one set lastdrive=<letter> in CONFIG.SYS
  246.   to accommodate the additional drive letters that CD-ROM device drivers
  247.   will require.
  248. ───────────────────────────────────────────────────────────────────────────
  249.  
  250. The number-of-units field is set by the device driver to the number of disks
  251. that are supported. Normal character devices do not support more than one
  252. unit and MS-DOS does not expect a character device to handle more than one
  253. unit or have a nonzero subunit value in the request header. Since these
  254. device drivers are not called by MS-DOS directly, this is not a problem.
  255. Nonetheless, the number of units returned by the device driver in the
  256. number-of-units field during the INIT call must be 0, since MS-DOS makes the
  257. INIT call and does not expect a nonzero value for a character device.
  258. MSCDEX.EXE will never see what is returned anyway, and relies on the number-
  259. of-units field in the device header.
  260.  
  261. Sample device header:
  262.  
  263. HsgDrv    DD   -1             ; Pointer to next device
  264.           DW   0c800h         ; Device attributes
  265.           DW   STRATEGY       ; Pointer to device strategy routine
  266.           DW   DEVINT         ; Pointer to device interrupt routine
  267.           DB   'HSG-CD1 '     ; 8-byte character device name field
  268.           DW   0              ; Reserved (must be zero)
  269.           DB   0              ; Drive letter (must be zero)
  270.           DB   1              ; Number of units supported (one or more)
  271.  
  272. As with other MS-DOS device drivers, the code originates at offset 0, not
  273. 100H. The first device header will be at offset 0 of the code segment. The
  274. pointer to the next driver is a double word field (offset/segment) that is
  275. the address of the next device driver in the list, or -1 if the device
  276. header is the only one or the last in the list. The strategy and interrupt
  277. entry points are word fields and must be offsets into the same segment as
  278. the device header. The device driver is expected to overwrite the name(s) in
  279. each of its one or more device headers with the <device_name> command line
  280. arguments during its initialization.
  281.  
  282. MSCDEX.EXE will call the device driver in the following manner:
  283.  
  284.   1.  MSCDEX.EXE makes a far call to the strategy entry.
  285.  
  286.   2.  MSCDEX.EXE passes device driver information in a request header to the
  287.       strategy routine.
  288.  
  289.   3.  MSCDEX.EXE makes a far call to the interrupt entry.
  290.  
  291.  
  292. Request header
  293.  
  294. MSCDEX.EXE will call the device's strategy routine with the address of a
  295. request header in ES:BX. The format of the request header is the same as
  296. what is described in the MS-PRM.
  297.  
  298. ReqHdr    DB   ?         ; Length in bytes of request header
  299.           DB   ?         ; Subunit code for minor devices
  300.           DB   ?         ; Command code field
  301.           DW   ?         ; Status
  302.           DB   8 dup (?) ; Reserved
  303.  
  304. Status
  305.  
  306. The status word also has the same format as described in the MS-PRM. It is 0
  307. on entry and is set by the device driver.
  308.  
  309.   Bit 15         - Error bit
  310.   Bit 14-10      - Reserved
  311.   Bit  9         - Busy
  312.   Bit  8         - Done
  313.   Bit  7-0       - Error code (bit 15 on)
  314.  
  315. Bit 15, the error bit, is set by the device driver if an error is detected
  316. or if an invalid request is made to the driver. The low 8 bits indicate the
  317. error code.
  318.  
  319. Bit 9, the busy bit, should be set by the device driver when the drive is in
  320. audio play mode. Device drivers should fail all requests to the physical
  321. device that require head movement when the device is playing and return the
  322. request with this bit and the error bit set and an error code. Requests that
  323. would not interrupt audio play may return without error but will also have
  324. this bit set when the drive is in audio play mode. Play mode can be
  325. terminated prematurely with a reset or STOP AUDIO request and a new request
  326. can be made at that point. Monitoring this bit in each successive request,
  327. an Audio Q-Channel Info IOCTL for example, will tell when play mode is
  328. complete.
  329.  
  330. Bit 8, the done bit, is set by the device driver when the operation is
  331. finished.
  332.  
  333. Error codes are the following:
  334.  
  335.   0  Write-protect violation
  336.   1  Unknown unit
  337.   2  Drive not ready
  338.   3  Unknown command
  339.   4  CRC error
  340.   5  Bad drive request structure length
  341.   6  Seek error
  342.   7  Unknown media
  343.   8  Sector not found
  344.   9  Printer out of paper
  345.   A  Write fault
  346.   B  Read fault
  347.   C  General failure
  348.   D  Reserved
  349.   E  Reserved
  350.   F  Invalid disk change
  351.  
  352. Command Code Field
  353.  
  354. The following values are valid command codes:
  355.  
  356.     0  INIT
  357.     1   MEDIA CHECK (block devices)
  358.     2   BUILD BPB (block devices)
  359.     3  IOCTL INPUT
  360.     4   INPUT (read)
  361.     5   NONDESTRUCTIVE INPUT NO WAIT
  362.     6   INPUT STATUS
  363.     7  INPUT FLUSH
  364.     8   OUTPUT (write)
  365.     9   OUTPUT WITH VERIFY
  366.    10   OUTPUT STATUS
  367.    11  OUTPUT FLUSH
  368.    12  IOCTL OUTPUT
  369.    13  DEVICE OPEN
  370.    14  DEVICE CLOSE
  371.    15   REMOVABLE MEDIA (block devices)
  372.    16   OUTPUT UNTIL BUSY
  373.   128  READ LONG                (NEW) 
  374.   129   Reserved
  375.   130  READ LONG PREFETCH       (NEW)
  376.   131  SEEK                     (NEW)
  377.   132  PLAY AUDIO               (NEW)
  378.   133  STOP AUDIO               (NEW)
  379.   134  WRITE LONG               (NEW) 
  380.   135  WRITE LONG VERIFY        (NEW) 
  381.   136  RESUME AUDIO             (NEW)
  382.  
  383. Unsupported or illegal commands will set the error bit and return the error
  384. code for Unknown Command. This includes command codes 1, 2, 4, 5, 6, 8, 9,
  385. 10, 15, 16, and 129; and 11, 134 and 135 for systems that do not support
  386. writing.
  387.  
  388. If, in the time since the last request to that device driver unit, the media
  389. has changed, the device driver will return the error code for invalid disk
  390. change and set the error bit. MSCDEX.EXE will then decide whether to retry
  391. the request or abort it.
  392.  
  393. The minimal CD-ROM device driver will read cooked Mode 1 data sectors using
  394. HSG addressing mode and return appropriate values for the IOCTL calls. Most
  395. other features enhance performance or add useful capabilities.
  396.  
  397.  
  398. INIT
  399.  
  400. Command code = 0
  401. ES:BX = INIT
  402.  
  403. INIT      DB   13 dup (0); Request header
  404.           DB   0         ; Number of units (must be 0)
  405.           DD   ?         ; End address
  406.           DD   ?         ; Ptr to BPB array
  407.           DB   0         ; Block device number
  408.  
  409. This call is made only once, when the device is installed. INIT and a single
  410. IOCTL call for the device header address are the only device driver calls
  411. that come directly from MS-DOS. Because the INIT function is called from MS-
  412. DOS, the number of units returned is 0, as for normal MS-DOS character
  413. devices. MSCDEX.EXE will get the number of units supported from the device
  414. header.
  415.  
  416. The device must return the END ADDRESS, which is a DWORD pointer to the end
  417. of the portion of the device driver to remain resident. Code and data
  418. following the pointer is used for initialization and then discarded. If
  419. there are multiple device drivers in a single file, the ending address
  420. returned by the last INIT call will be the one that MS-DOS uses, but it is
  421. recommended that all the device drivers in the file return the same address.
  422. The code to remain resident for all the devices in a single file should be
  423. grouped together low in memory with the initialization code for all devices
  424. following it in memory.
  425.  
  426. The pointer to BPB array points to the character after the "=" on the line
  427. in CONFIG.SYS that caused this device driver to be loaded. This data is
  428. read-only and allows the device driver to scan the invocation line for
  429. parameters. This line is terminated by a carriage return or a line feed.
  430. During initialization, the device driver must set the device name field in
  431. the device header to the argument provided on the invocation line in
  432. CONFIG.SYS. The device driver must also check that the device_name command
  433. line argument is a legal 8-character filename and pad it out to 8 characters
  434. with spaces (20H) when copying it to the device name field.
  435.  
  436. The block device number and number of units are both 0 for character
  437. devices.
  438.  
  439.  
  440. READ (IOCTL Input)
  441.  
  442. Command code = 3
  443. ES:BX = IOCTLI
  444.  
  445. IOCTLI    DB   13 dup (0); Request header
  446.           DB   0         ; Media descriptor byte from BPB
  447.           DD   ?         ; Transfer address
  448.           DW   ?         ; Number of bytes to transfer
  449.           DW   0         ; Starting sector number 
  450.           DD   0         ; DWORD ptr to requested vol ID if error 0FH
  451.  
  452. The media descriptor byte, starting sector number, and volume ID fields are
  453. all 0.
  454.  
  455. The transfer address points to a control block that is used to communicate
  456. with the device driver. The first byte of the control block determines the
  457. request that is being made. If the command code is reserved or the function
  458. not supported, then the device driver will return the error code for Unknown
  459. Command. If, for some reason, the device driver is not able to process the
  460. request at that time, it will return the error code for Drive Not Ready.
  461.  
  462.           Number of Bytes
  463.  Code       to Transfer                 Function
  464.  
  465.    0             5            Return Address of Device Header
  466.    1             6            Location of Head
  467.    2             ?            Reserved
  468.    3             ?            Error Statistics
  469.    4             9            Audio Channel Info
  470.    5           130            Read Drive Bytes
  471.    6             5            Device Status
  472.    7             4            Return Sector Size
  473.    8             5            Return Volume Size
  474.    9             2            Media Changed
  475.   10             7            Audio Disk Info
  476.   11             7            Audio Track Info
  477.   12            11            Audio Q-Channel Info
  478.   13            13            Audio Sub-Channel Info
  479.   14            11            UPC Code
  480.   15            11            Audio Status Info
  481.   16-255        ?             Reserved
  482.  
  483. Return Address of Device Header
  484.  
  485. Raddr     DB   0         ; Control block code
  486.           DD   ?         ; Address of device header
  487.  
  488. The device driver will fill the 4-byte field with the address of its device
  489. header. This is used by MSCDEX.EXE to locate the device driver's strategy
  490. and interrupt routines.
  491.  
  492. Location of Head
  493.  
  494. LocHead   DB   1         ; Control block code
  495.           DB   ?         ; Addressing mode
  496.           DD   ?         ; Location of drive head
  497.  
  498. The device driver will return a 4-byte address that indicates where the head
  499. is located. The value will be interpreted based on the addressing mode. (See
  500. function READ LONG for more information about addressing modes.)
  501.  
  502. ───────────────────────────────────────────────────────────────────────────
  503. NOTE:
  504.   The drive could provide this information by monitoring the Q-channel on
  505.   the disk.
  506. ───────────────────────────────────────────────────────────────────────────
  507.  
  508. Error Statistics
  509.  
  510. ErrStat   DB   3         ; Control block code
  511.           DB   N dup (?) ; Error statistics
  512.  
  513. The format of the Error Statistics is not yet defined.
  514.  
  515. Audio Channel Info
  516.  
  517. AudInfo   DB   4       ; Control block code
  518.           DB   ?       ; Input  channel (0, 1, 2, or 3) for output channel 0
  519.           DB   ?       ; Volume control (0 - 0xff) for output channel 0
  520.           DB   ?       ; Input  channel (0, 1, 2, or 3) for output channel 1
  521.           DB   ?       ; Volume control (0 - 0xff) for output channel 1
  522.           DB   ?       ; Input  channel (0, 1, 2, or 3) for output channel 2
  523.           DB   ?       ; Volume control (0 - 0xff) for output channel 2
  524.           DB   ?       ; Input  channel (0, 1, 2, or 3) for output channel 3
  525.           DB   ?       ; Volume control (0 - 0xff) for output channel 3
  526.  
  527. This function returns the present settings of the audio channel control set
  528. with the Audio Channel Control Ioctl Write function. The default settings
  529. for the audio channel control are for each input channel to be assigned to
  530. its corresponding output channel (0 to 0, 1 to 1, etc.) and for the volume
  531. control on each channel is set at 0xff.
  532.  
  533. Read Drive Bytes
  534.  
  535. DrvBytes  DB   5          ; Control block code
  536.           DB   ?          ; Number bytes read
  537.           DB   128 dup (?); Read buffer
  538.  
  539. Data returned from the CD-ROM drive itself can be read using this function.
  540. The number-bytes-read field returns the length of the number of bytes read,
  541. which will not exceed 128 per call. If more than this needs to be returned,
  542. the call will be repeated until the number returned is 0.
  543.  
  544. The function and content of these bytes are entirely device and device
  545. driver dependent. This function is provided to allow access to device-
  546. specific features that are not addressed under any other portion of the
  547. device driver spec.
  548.  
  549. Device Status
  550.  
  551. DevStat   DB   6         ; Control block code
  552.           DD   ?         ; Device parameters
  553.  
  554. The device driver will return a 32-bit value. Bit 0 is the least significant
  555. bit. The bits are interpreted as follows:
  556.  
  557.   Bit 0     0    Door closed
  558.             1    Door open
  559.   
  560.   Bit 1     0    Door locked
  561.             1    Door unlocked
  562.   
  563.   Bit 2     0    Supports only cooked reading
  564.             1    Supports cooked and raw reading
  565.   
  566.   Bit 3     0    Read only
  567.             1    Read/write
  568.   
  569.   Bit 4     0    Data read only
  570.             1    Data read and plays audio/video tracks
  571.   
  572.   Bit 5     0    No interleaving
  573.             1    Supports interleaving
  574.   
  575.   Bit 6     0    Reserved
  576.   
  577.   Bit 7     0    No prefetching
  578.             1    Supports prefetching requests
  579.   
  580.   Bit 8     0    No audio channel manipulation
  581.             1    Supports audio channel manipulation
  582.   
  583.   Bit 9     0    Supports HSG addressing mode
  584.             1    Supports HSG and Red Book addressing modes
  585.   
  586.   Bit 10-31 0    Reserved (all 0)
  587.  
  588. Return Sector Size
  589.  
  590. SectSize  DB   7         ; Control block code
  591.           DB   ?         ; Read mode
  592.           DW   ?         ; Sector size
  593.  
  594. The device driver will return the sector size of the device given the read
  595. mode provided. In the case of CD-ROM, the value returned for cooked is 2048,
  596. and the return value  for raw is 2352.
  597.  
  598. Return Volume Size
  599.  
  600. VolSize   DB   8         ; Control block code
  601.           DD   ?         ; Volume size
  602.  
  603. The device driver will return the number of sectors on the device. The size
  604. returned is the address of the lead-out track in the TOC converted to a
  605. binary value according to FRAME + (SEC * 75) + (MIN * 60 * 75). A disc with
  606. a lead out track starting at 31:14.63 would return a volume size of 140613.
  607. The address of the lead-out track is assumed to point to the first sector
  608. following the last addressable sector recorded on the disc.
  609.  
  610. Media Changed
  611.  
  612. MedChng   DB   9         ; Control block code
  613.           DB   ?         ; Media byte
  614.  
  615. The normal media check function (command code 1) is not performed on
  616. character devices and contains additional semantics that are not needed for
  617. CD-ROM device drivers. This is why there is an IOCTL request for this
  618. function.
  619.  
  620. When the device driver receives a call to see if the media has changed on
  621. that subunit, it will return one of the following values:
  622.  
  623.    1         Media not changed
  624.    0         Don't know if changed
  625.   -1 (0FFh)  Media changed
  626.  
  627. If the driver can assure that the media has not been changed (through a
  628. door-lock or other interlock mechanism), performance is enhanced because
  629. MSCDEX.EXE does not need to reread the VTOC and invalidate in-memory buffers
  630. for each directory access. For drives that do not report if the media has
  631. changed, CD-ROM device drivers can utilize the same solution that has been
  632. applied to floppy disks. In some floppy-disk device drivers, if the MEDIA
  633. CHECK occurs within 2 seconds of a floppy-disk access, the driver reports
  634. "Media not changed." It is highly recommended though that drives be able to
  635. detect and report media changes.
  636.  
  637. If the drive can enforce a door lock mechanism so that the device driver is
  638. notified when the door lock has been unlocked or the device driver is
  639. requested to do so by MSCDEX.EXE, then to improve performance, the driver
  640. could return that the media has not changed without bothering to communicate
  641. with the physical device.
  642.  
  643. If the media has not been changed, MSCDEX.EXE will proceed with the disk
  644. access. If the value returned is "Don't know," or "Media changed," then
  645. MSCDEX.EXE will check to see if the disk has changed. It will  continue if
  646. it has not, and reinitialize what it knows about the disk if it has.
  647.  
  648. It is not necessary for the device driver to do anything for the volume ID
  649. when the media has changed.
  650.  
  651. Audio Disk Info
  652.  
  653. DiskInfo  DB   10        ; Control block code
  654.           DB   ?         ; Lowest track number
  655.           DB   ?         ; Highest track number
  656.           DD   ?         ; Starting point of the lead-out track
  657.  
  658. This function returns TOC (Table of Contents) information from the Q-Channel
  659. in the lead-in track indicating what the first and last track numbers are
  660. and the Red Book address for the lead-out track (PMIN/PSEC/PFRAME when POINT
  661. = A2). The first and last track numbers are binary values and not BCD. It is
  662. recommended that the information for Audio Disk Info and Audio Track Info
  663. should be read by the drive when the disc is initialized and made accessible
  664. to the driver so that when these functions are called, the drive or driver
  665. do not have to interrupt audio play to read them from the TOC. If the TOC is
  666. not made available to the driver and the driver must obtain the information
  667. itself from the lead-in track, the driver should read and and attempt to
  668. cache the disk and track information during the Audio Disk Info command and
  669. invalidate this information only if the media changes.
  670.  
  671. Audio Track Info
  672.  
  673. TnoInfo   DB   11        ; Control block code
  674.           DB   ?         ; Track number
  675.           DD   ?         ; Starting point of the track
  676.           DB   ?         ; Track control information
  677.  
  678. This function takes a binary track number, from within the range specified
  679. by the lowest and highest track number given by the Audio Disk Info command,
  680. and returns the Red Book address for the starting point of the track and the
  681. track control information for that track. The track control information byte
  682. corresponds to the byte in the TOC in the lead-in track containing the two
  683. 4-bit fields for CONTROL and ADR in the entry for that track. The CONTROL
  684. information is in the most significant 4 bits and the ADR information is in
  685. the lower 4 bits. The track control information is encoded as follows:
  686.  
  687.   00x00000  - 2 audio channels without pre-emphasis
  688.   00x10000  - 2 audio channels with pre-emphasis
  689.   10x00000  - 4 audio channels without pre-emphasis
  690.   10x10000  - 4 audio channels with pre-emphasis
  691.   01x00000  - data track
  692.   01x10000  - reserved
  693.   11xx0000  - reserved
  694.   xx0x0000  - digital copy prohibited
  695.   xx1x0000  - digital copy permitted
  696.  
  697. Audio Q-Channel Info
  698.  
  699. QInfo     DB   12        ; Control block code
  700.           DB   ?         ; CONTROL and ADR byte
  701.           DB   ?         ; Track number (TNO)
  702.           DB   ?         ; (POINT) or Index (X)
  703.                          ; Running time within a track
  704.           DB   ?         ; (MIN)
  705.           DB   ?         ; (SEC)
  706.           DB   ?         ; (FRAME)
  707.           DB   ?         ; (ZERO)
  708.                          ; Running time on the disk
  709.           DB   ?         ; (AMIN) or (PMIN)
  710.           DB   ?         ; (ASEC) or (PSEC)
  711.           DB   ?         ; (AFRAME) or (PFRAME)
  712.  
  713. This function reads and returns the most up to date Q-channel address
  714. presently available. It should not interrupt the present status of the drive
  715. as one of its intended purposes is to monitor the location of the read head
  716. while playing audio tracks. This function should return valid information
  717. even when no audio tracks are being played and the head is stationary. The
  718. fields returned correspond to the data that is stored in the Q-channel as
  719. described in the Red Book. The values in MIN-SEC-FRAME, AMIN-ASEC-AFRAME and
  720. PMIN-PSEC-PFRAME are converted by the driver from BCD to binary so that
  721. minutes range from 0 to 59+, seconds from 0 to 59, and frames from 0 to 74.
  722. The Control and ADR byte, TNO, and POINT/Index bytes are always passed
  723. through as they appear on the disc and are not converted. If the drive
  724. returns Q-channel information when ADR is not equal to 1, then when ADR is
  725. not equal to 1 all ten bytes of information are passed through unmodified to
  726. the caller. 
  727.  
  728. Audio Sub-Channel Info
  729.  
  730. SubChanInfo DB   13        ; Control block code
  731.             DD   ?         ; Starting frame address
  732.             DD   ?         ; Transfer address
  733.             DD   ?         ; Number of sectors to read
  734.  
  735. This function takes a Red Book address for a particular frame (also known as
  736. a block or frame) and copies 96 bytes of sub-channel information per frame
  737. for all the sectors that are requested sequentially at the transfer address
  738. given. Each 96 bytes of information do not include the two sync patterns (S0
  739. and S1) that head the subcoding block but only the the 96 bytes of subcoding
  740. symbols each with one bit of information for the eight different channels
  741. (P-W) that follow them. P is the MSB, W is the LSB of each byte.
  742.  
  743. The caller is responsible for making sure that 96 *
  744. Number_of_sectors_to_read bytes are available at the transfer address for
  745. the device driver to store the results.
  746.  
  747. Data definition and integrity restrictions for data received with this
  748. command are interpreted according to the CD-ROM standard (Red and Yellow
  749. Book).
  750.  
  751. UPC Code
  752.  
  753. UPCCode   DB   14        ; Control block code
  754.           DB   ?         ; CONTROL and ADR byte
  755.           DB   7 dup (?) ; UPC/EAN code
  756.                          ; (last 4 bits are zero; the low-order nibble of
  757.                          ; byte 7)
  758.           DB   ?         ; Zero
  759.           DB   ?         ; Aframe
  760.  
  761. This function returns the UPC/EAN (Universal Product Code - BAR coding) for
  762. the disc. This information is stored as a mode-2 (ADR=2) Q-channel entry.
  763. The UPC code is 13 successive BCD digits (4 bits each) followed by 12 bits
  764. of zero. The last byte is the continuation of FRAME in mode-1 though in the
  765. lead-in track (TNO=0) this byte is zero. If the CONTROL/ADR byte is zero or
  766. if the 13 digits of UPC code are all zero, then either no catalog number was
  767. encoded on the disc or it was missed by the device driver. If the command is
  768. not supported, then the driver will return an error code of Unknown Command.
  769. If the command is supported but the disc does not have a UPC Code recorded,
  770. then the driver will return an error code of Sector not Found.
  771.  
  772. Audio Status Info
  773.  
  774. AudStat DB   15        ; Control block code
  775.         DW   ?         ; Audio status bits
  776.                        ; Bit 0 is Audio Paused bit
  777.                        ; Bits 1-15 are reserved
  778.         DD   ?         ; Starting location of last Play or for next Resume
  779.         DD   ?         ; Ending location for last Play or for next Resume
  780.  
  781. The Audio Paused bit and Starting and Ending locations are those referred to
  782. in the RESUME command.
  783.  
  784.  
  785. WRITE (IOCTL OUTPUT)
  786.  
  787. Command code = 12
  788. ES:BX = IOCTLO
  789.  
  790. IOCTLO    DB   13 dup (0); Request header
  791.           DB   0         ; Media descriptor byte from BPB
  792.           DD   ?         ; Transfer address
  793.           DW   ?         ; Number of bytes to transfer
  794.           DW   0         ; Starting sector number 
  795.           DD   0         ; DWORD ptr to requested vol ID if error 0FH
  796.  
  797. The media descriptor byte, starting sector number, and volume ID fields are
  798. all 0.
  799.  
  800. The transfer address points to a control block that is used to communicate
  801. with the device driver. The first byte of the control block determines the
  802. request that is being made. The Length of Block is the number of bytes to
  803. transfer.
  804.  
  805.        Length of
  806. Code   Block            Function
  807.  
  808.   0      1              Eject Disk
  809.   1      2              Lock/Unlock Door
  810.   2      1              Reset Drive
  811.   3      9              Audio Channel Control
  812.   4      ?              Write Device Control String
  813.   5      1              Close Tray
  814.   6-255  ?              Reserved
  815.  
  816. Eject Disk
  817.  
  818. Eject          DB   0         ; Control block code
  819.  
  820. The device driver will unlock the drive and eject the CD-ROM disk from the
  821. drive unit. The door will report as being open until the user has inserted
  822. a disk  into the drive unit and closed the door. The status bit for door
  823. open can be monitored to determine when a disk has been reinserted.
  824.  
  825. Lock/Unlock Door
  826.  
  827. LockDoor  DB   1         ; Control block code
  828.           DB   ?         ; Lock function
  829.  
  830. When this function is received, the device driver will ask the CD-ROM drive
  831. to unlock or lock the door. If lock function is 0, the device driver will
  832. unlock the door. If lock function is 1, it will lock the door.
  833.  
  834. Reset Drive
  835.  
  836. ResetDrv  DB   2         ; Control block code
  837.  
  838. This function directs the device driver to reset and reinitialize the
  839. drive.
  840.  
  841. Audio Channel Control
  842.  
  843. AudInfo   DB   3     ; Control block code
  844.           DB   ?     ; Input  channel (0, 1, 2, or 3) for output channel 0
  845.           DB   ?     ; Volume control (0 - 0xff) for output channel 0
  846.           DB   ?     ; Input  channel (0, 1, 2, or 3) for output channel 1
  847.           DB   ?     ; Volume control (0 - 0xff) for output channel 1
  848.           DB   ?     ; Input  channel (0, 1, 2, or 3) for output channel 2
  849.           DB   ?     ; Volume control (0 - 0xff) for output channel 2
  850.           DB   ?     ; Input  channel (0, 1, 2, or 3) for output channel 3
  851.           DB   ?     ; Volume control (0 - 0xff) for output channel 3
  852.  
  853. This function is intended to provide playback control of audio information
  854. on the disk. It allows input channels on the CD-ROM to be assigned to
  855. specific output speaker connections. The purpose of this function is to
  856. allow two independent channels to be recorded──in different languages for
  857. example──and to play back only one of them at a time or to be able to
  858. manipulate an audio signal so that the source appears to move──to make a
  859. sound seem to move from left to right for example.
  860.  
  861. Output channel 0 is the left channel, 1 is right, 2 is left prime, and 3 is
  862. right prime. The Red Book specification allows for 4 audio channels. The two
  863. "prime" channels (2 and 3) extend stereo to quadrophonic stereo.
  864.  
  865. An audio volume setting of 0 means off. Drives that don't support 4 output
  866. audio channels may ignore output to channels 2 and 3. Assignment of input
  867. channels 2 and 3 to output channels 0 and 1 may be treated as though the
  868. volume control for that channel is 0.
  869.  
  870. Drives that do not support variable audio control will treat a setting of 0
  871. as off and 1-0xff as on. Drives that support less than 256 volume settings
  872. will do their best to break up the 256 settings among the settings they can
  873. support. E.g. if there are 16 settings supported, then the first setting
  874. will cover 0x01-0x10, the second 0x11-0x20...the sixteenth 0xf1-0xff. Drives
  875. that can't play a single channel in both must play only that one channel and
  876. try to suppress the other if possible. Drives that can't swap channels
  877. should play the channel that was moved in its normal channel.
  878.  
  879. Write Device Control String
  880.  
  881. DrvBytes  DB   4         ; Control block code
  882.           DB   N dup (?) ; Write buffer
  883.  
  884. This function is provided to allow programs to talk directly to the CD-ROM
  885. drive. All remaining bytes are sent uninterpreted to the drive unit.
  886.  
  887. The function and content of these bytes are entirely device and device
  888. driver dependent. This function is provided to allow access to device-
  889. specific features that are not addressed under any other portion of the
  890. device driver spec.
  891.  
  892. Close Tray
  893.  
  894. CloseTray DB   5         ; Control block code
  895.  
  896. This command is the logical complement to the Eject Disk command. This
  897. command will instructs drives that can do so to close the door or tray.
  898.  
  899.  
  900. READ LONG
  901.  
  902. Command code = 128
  903. ES:BX = ReadL
  904.  
  905. ReadL     DB   13 dup (0); Request header
  906.           DB   ?         ; Addressing mode
  907.           DD   ?         ; Transfer address
  908.           DW   ?         ; Number of sectors to read
  909.           DD   ?         ; Starting sector number
  910.           DB   ?         ; Data read mode
  911.           DB   ?         ; Interleave size
  912.           DB   ?         ; Interleave skip factor
  913.  
  914. The request block is different from a normal character device READ to
  915. accommodate the larger size and different characteristics of CD-ROM
  916. devices.
  917.  
  918. The media descriptor byte, which has no meaning for character devices, is
  919. now the addressing mode field. The following values are recognized
  920. addressing modes:
  921.  
  922.   0      HSG addressing mode
  923.   1      Red Book addressing mode
  924.   2-255  Reserved
  925.  
  926. The default addressing mode is the HSG addressing mode. Long (DWORD) address
  927. values are treated as logical block numbers, as defined by the High Sierra
  928. proposal. When Red Book addressing mode is on, all disk addresses are
  929. interpreted as Minute/Second/Frame addresses, according to the Philips/Sony
  930. Red Book standard. Each of these fields is 1 byte. The frame byte is the
  931. least significant byte of the address field, the "second" byte the next most
  932. significant, the minute byte the next, and the most significant byte of the
  933. 4-byte field is unused. These values are represented in binary rather than
  934. in BCD format. For example, if we are referencing the sector addressed by
  935. minute 36, second 24, frame 12, the hex long value for this would be
  936. 0x0024180C. The relationship between High Sierra sectors and Red Book frames
  937. is described by the equation:
  938.  
  939.   Sector = Minute * 60 * 75 + Second * 75 + Frame - 150
  940.  
  941. The byte/sector count field becomes the number of sectors to read and the
  942. starting sector number expands from one word to two, which  means we can
  943. address up to 4 giga-sectors (over 8 terabytes). The DWORD ptr for requested
  944. volume ID is eliminated and MSCDEX.EXE will keep track of what volume is
  945. needed.
  946.  
  947. MSCDEX.EXE handles buffering requests, but performance may be improved if
  948. the device driver reads ahead or uses a sector caching scheme, given the
  949. slow seek times of CD-ROM drives. The operating system will use the prefetch
  950. function when it can to give hints to the driver.
  951.  
  952. The data read mode field will be one of the following:
  953.  
  954.   0      Cooked mode
  955.   1      Raw mode
  956.   2-255  Reserved
  957.  
  958. Cooked mode is the default mode in which the hardware typically handles the
  959. EDC/ECC and the device driver returns 2048 bytes of data per sector read.
  960. When raw mode is set, the driver will return all 2352 bytes of user data,
  961. including any EDC/ECC present independent of the actual sector mode (Mode 2
  962. Form 1 vs. Mode 2 Form 2). User programs will have to consider this and
  963. allow enough room for buffer space when reading in raw mode as each sector
  964. returned will take up 2352 bytes of space. Drives that cannot return all
  965. 2352 bytes will return what they can and leave blank what they cannot. For
  966. example, drives that can return all 2336 bytes except the 16 byte header
  967. will leave a space in the first 16 bytes where the header would go so that
  968. the sectors align on 2352 byte boundaries. Drivers should do what they can
  969. to return as much of the user data per sector as possible.
  970.  
  971. The two interleave parameters are for drivers that support interleaved
  972. reading. If the driver does not support interleaving, these fields are both
  973. ignored. If it does, interleave size is the number of consecutive logical
  974. blocks or sectors that are stored sequentially, and the interleave skip
  975. factor is the number of consecutive logical blocks or sectors that separate
  976. portions of the interleaved file.
  977.  
  978.  
  979. READ LONG PREFETCH
  980.  
  981. Command code = 130
  982. ES:BX = ReadLPre
  983.  
  984. ReadLPre  DB   13 dup (0); Request header
  985.           DB   ?         ; Addressing mode
  986.           DD   0         ; Transfer address
  987.           DW   ?         ; Number of sectors to read
  988.           DD   ?         ; Starting sector number
  989.           DB   ?         ; Read mode
  990.           DB   ?         ; Interleave size
  991.           DB   ?         ; Interleave skip factor
  992.  
  993. This function is similar in form to READ LONG, but control returns
  994. immediately to the requesting process. The device driver is not obligated to
  995. read in the requested sectors but can instead consider the request for these
  996. sectors as hints from the operating system that they are likely to be
  997. needed. It is recommended that at a minimum, the driver seek to the location
  998. provided. The attribute in the device status for prefetching is used to
  999. distinguish drivers that do more than just seek to the given location. The
  1000. requests are low priority and preemptible by other requests for service. A
  1001. READ LONG PREFETCH with 0 number of sectors to read should be treated as an
  1002. advisory seek, and the driver can, if it is not busy, move the head to the
  1003. starting sector. Since prefetching requests are advisory, there will be no
  1004. functional difference between a device driver that supports prefetching from
  1005. one that does not, except in terms of performance. The transfer address is
  1006. not applicable for this call as the driver is not meant to transfer any data
  1007. into the user address space. 
  1008.  
  1009.  
  1010. SEEK
  1011.  
  1012. Command code = 131
  1013. ES:BX = SeekReq
  1014.  
  1015. SeekReq   DB   13 dup (0); Request header
  1016.           DB   ?         ; Addressing mode
  1017.           DD   0         ; Transfer address
  1018.           DW   0         ; Number of sectors to read
  1019.           DD   ?         ; Starting sector number
  1020.  
  1021. Control returns immediately to the caller without blocking and waiting for
  1022. the seek to be completed. The number of sectors to be read and the transfer
  1023. address are ignored. SEEK is used to relocate the head in order to begin
  1024. playing audio or video tracks, or in anticipation of reading in a particular
  1025. region on the disk. Further requests for disk activity will wait until the
  1026. given SEEK is completed. This seek is not advisory and the head must move to
  1027. the desired location.
  1028.  
  1029.  
  1030. PLAY AUDIO
  1031.  
  1032. Command code = 132
  1033. ES:BX = PlayReq
  1034.  
  1035. PlayReq   DB   13 dup (0); Request header
  1036.           DB   ?         ; Addressing mode
  1037.           DD   ?         ; Starting sector number
  1038.           DD   ?         ; Number of sectors to read
  1039.  
  1040. This function will cause the driver to play the selected audio tracks until
  1041. the requested sectors have been exhausted or until play is interrupted with
  1042. a AUDIO STOP request. Control returns immediately to the caller. Monitoring
  1043. the busy bit in the status word will determine if the drive is presently
  1044. playing audio and also when the play request is completed.
  1045.  
  1046.  
  1047. STOP AUDIO
  1048.  
  1049. Command code = 133
  1050. ES:BX = StopPlayReq
  1051.  
  1052. StopPlayReq    DB   13 dup (0)     ; Request header
  1053.  
  1054. This function is included to interrupt the drive unit when it is currently
  1055. in play mode. At the next stopping point it reaches, the drive will
  1056. discontinue playing and process the next request. If the drive is not
  1057. currently playing or does not support playing, this request is ignored.
  1058.  
  1059.  
  1060. RESUME AUDIO
  1061.  
  1062. Command code = 136
  1063. ES:BX = ResumeReq
  1064.  
  1065. ResumeReq DB   13 dup (0)     ; Request header
  1066.  
  1067. This function is used to resume playing audio tracks when play has been
  1068. interrupted with the STOP AUDIO command. Its behavior should correspond to
  1069. the following:
  1070.  
  1071.   RESET, NEW DISC, PLAY/RESUME COMPLETED
  1072.        playing = FALSE;
  1073.        paused  = FALSE;
  1074.        last_startloc = 0;
  1075.        last_endloc   = 0;
  1076.   
  1077.   PLAY_AUDIO(startloc, endloc) {
  1078.        if (play(startloc, endloc) != SUCCESSFUL) {
  1079.             return error;
  1080.   
  1081.        playing = TRUE;
  1082.        paused = FALSE;
  1083.        last_startloc = startloc
  1084.        last_endloc = endloc
  1085.        return no error;
  1086.        }
  1087.   
  1088.   STOP_AUDIO() {
  1089.        if (playing) {
  1090.             last_startloc = present q-channel location
  1091.             playing = FALSE;
  1092.             paused = TRUE;
  1093.             if (stop() == SUCCESSFUL)
  1094.                  return no error;
  1095.             return error;
  1096.             }
  1097.        else {
  1098.             playing = FALSE;
  1099.             paused = FALSE;
  1100.             last_startloc = 0;
  1101.             last_endloc = 0;
  1102.             return no error;
  1103.             }
  1104.        }
  1105.   
  1106.   RESUME_AUDIO() {
  1107.        if (paused) {
  1108.             if (play(last_startloc, last_endloc) != SUCCESSFUL)
  1109.                  return error;
  1110.             playing = TRUE;
  1111.             paused = FALSE;
  1112.             return no error;
  1113.             }
  1114.        else
  1115.             return error;
  1116.   
  1117. Note that the playing flag corresponds to the state that should be reported
  1118. by the busy bit in the status word in the request header when the drive is
  1119. in audio play mode. The paused flag corresponds to the Audio Paused bit and
  1120. last_startloc and last_endloc correspond to the starting and ending location
  1121. in the Audio Status Info IOCTL.
  1122.  
  1123.  
  1124. WRITE LONG
  1125.  
  1126. Command code = 134
  1127. ES:BX = WriteL
  1128.  
  1129. WriteL    DB   (dup 13 0); Request header
  1130.           DB   ?         ; Addressing mode
  1131.           DD   ?         ; Transfer address
  1132.           DW   ?         ; Number of sectors to write
  1133.           DD   ?         ; Starting sector number
  1134.           DB   ?         ; Write mode
  1135.           DB   ?         ; Interleave size
  1136.           DB   ?         ; Interleave skip factor
  1137.  
  1138. The device will copy the data at the transfer address to the CD RAM device
  1139. at the sector indicated. The media must be writable for this function to
  1140. work. Data is written sector by sector, depending on the current write mode
  1141. and the interleave parameters. The following values are recognized as valid
  1142. write modes:
  1143.  
  1144.   0      Mode 0
  1145.   1      Mode 1
  1146.   2      Mode 2 Form 1
  1147.   3      Mode 2 Form 2
  1148.   4-255  Reserved
  1149.  
  1150. Writing in Mode 1 is the default and must be supported. If the device driver
  1151. supports the other modes, then they can be used. If Mode 0 is used, the
  1152. transfer address is ignored and all sectors are written with zeroes. If the
  1153. current write mode is Mode 1 or Mode 2 Form 1, each sector will consist of
  1154. 2048 bytes of data located sequentially at the transfer address. If the
  1155. write mode is Mode 2 Form 2, the device driver will expect 2336 bytes of
  1156. data per sector at the transfer address. 
  1157.  
  1158.  
  1159. WRITE LONG VERIFY
  1160.  
  1161. Command code = 136
  1162. ES:BX = WriteLV
  1163.  
  1164. WriteLV   DB   (dup 13 0); Request header
  1165.           DB   ?         ; Addressing mode
  1166.           DD   ?         ; Transfer address
  1167.           DW   ?         ; Number of sectors to write
  1168.           DD   ?         ; Starting sector number
  1169.           DB   ?         ; Write mode
  1170.           DB   ?         ; Interleave size
  1171.           DB   ?         ; Interleave skip factor
  1172.  
  1173. This function is identical to WRITE LONG, with the addition that the device
  1174. driver is responsible for verifying the data written to the device.
  1175.  
  1176.  
  1177. INPUT FLUSH
  1178.  
  1179. Command code = 7
  1180. ES:BX = FlushI
  1181.  
  1182. FlushI         DB   13 dup (0)     ; Request header
  1183.  
  1184. Requests that the device driver free all input buffers and clear any pending
  1185. requests.
  1186.  
  1187.  
  1188. OUTPUT FLUSH
  1189.  
  1190. Command code = 11
  1191. ES:BX = FlushO
  1192.  
  1193. FlushO         DB   (dup 13 0)     ; Request header
  1194.  
  1195. Requests that the device driver write all unwritten buffers to the disk.
  1196.  
  1197.  
  1198. DEVICE OPEN
  1199. DEVICE CLOSE
  1200.  
  1201. Command code = 13,14
  1202. ES:BX = DevOpen, DevClose
  1203.  
  1204. DevOpen   DB   13 dup (0)     ; Request header
  1205.  
  1206. Used by the device driver to monitor how many different callers are
  1207. currently using the CD-ROM device driver. All new device drivers should
  1208. support these calls even if nothing is done with the information.
  1209.  
  1210. ████████████████████████████████████████████████████████████████████████████
  1211.  
  1212. Function Requests Specification
  1213.  
  1214. There is a need for access to features from the MSCDEX redirector that
  1215. transend DOS capabilities. This proposal documents a means that the
  1216. application can use to talk directly to MSCDEX to request information or set
  1217. parameters that only MSCDEX can provide. This document outlines some of the
  1218. features I think MSCDEX should support. Comments and suggestions are
  1219. welcome.
  1220.  
  1221. Access to these functions is provided through an INT 2Fh interface. AH
  1222. contains 15h which is what MSCDEX will use to tell its requests from those
  1223. of other INT 2Fh handlers. AL will contain the code of the function to be
  1224. performed.
  1225.  
  1226. Function Request Command Codes:
  1227.  
  1228. Contents of AL   Function
  1229.  
  1230. 00h              Get Number of CD-ROM Drive Letters
  1231. 01h              Get CD-ROM Drive Device List
  1232. 02h              Get Copyright File Name
  1233. 03h              Get Abstract File Name
  1234. 04h              Get Bibliographic Doc File Name
  1235. 05h              Read VTOC
  1236. 06h              Turn Debugging On
  1237. 07h              Turn Debugging Off
  1238. 08h              Absolute Disk Read
  1239. 09h              Absolute Disk Write
  1240. 0Ah              Reserved
  1241. 0Bh             CD-ROM Drive Check
  1242. 0Ch             MSCDEX Version
  1243. 0Dh             Get CD-ROM Drive Letters
  1244. 0Eh             Get/Set Volume Descriptor Preference
  1245. 0Fh             Get Directory Entry
  1246. 10h             Send Device Request
  1247. 11h-0FFh         Reserved
  1248.  
  1249. Get Number of CD-ROM Drive Letters
  1250.  
  1251.      AX   1500h
  1252.      BX   Number of CD-ROM drive letters used
  1253.      CX   Starting drive letter of CD-ROM drive letters (A=0, B=1, ...Z=25)
  1254.  
  1255. MSCDEX will return the number of CD-ROM drive letters in BX and the starting
  1256. drive letter in CX. The first CD-ROM device will be installed at the
  1257. starting drive letter and subsequent drives will be assigned the next
  1258. greater drive letter. A single device driver may be assigned to more than
  1259. one drive letter, such as the case of a device driver that supports multiple
  1260. units. MSCDEX keeps track of which sub-unit a particular drive letter is
  1261. assigned to.
  1262.  
  1263. ───────────────────────────────────────────────────────────────────────────
  1264. NOTE:
  1265.   This function can be used to determine if MSCDEX is installed by setting
  1266.   BX to zero before executing INT 2Fh. MSCDEX is not installed if BX is
  1267.   still zero on return.
  1268. ───────────────────────────────────────────────────────────────────────────
  1269.  
  1270. Also, in a networking environment, one cannot assume that drive letters will
  1271. always be assigned contiguously beginning with the starting drive letter.
  1272. Use function Get CD-ROM drive letters instead.
  1273.  
  1274. Get CD-ROM Drive Device List
  1275.  
  1276.      AX        1501h
  1277.      ES:BX     Transfer address; pointer to buffer to copy drive letter
  1278.                device list
  1279.  
  1280. The buffer must be large enough to hold the device list. By calling function
  1281. Get Number of CD-ROM Drive Letters, one can find out the number of CD-ROM
  1282. drive letters and the buffer size will be a multiple of that. This will be
  1283. an absolute maximum of 26. Each drive letter device entry will consist of
  1284. one byte for the sub-unit followed by 4 bytes for the address of the device
  1285. header assigned to that drive letter. This byte for the sub-unit takes care
  1286. of the problem of distinguishing which unit is assigned to which drive
  1287. letter for device drivers that handle sub-units.
  1288.  
  1289. For example: Suppose there are two installed CD-ROM device drivers, FOO,
  1290. which supports 1 sub-unit, and BAR, which supports two sub-units, on a
  1291. system with 2 floppy drives (A=0 and B=1) and a hard disk (C=2). Then asking
  1292. for the number of CD-ROM drive letters will report that there are 3 drive
  1293. letters used starting at drive letter D=3. ES:BX must point to a buffer that
  1294. is at least 3 * 5 = 15 bytes long. The buffer will be filled as follows:
  1295.  
  1296. ES:BX  = Buffer
  1297.  
  1298. Buffer   DB   0                        ; sub-unit of FOO on drive letter D:
  1299.          DD   <far addr of FOO device header>
  1300.          DB   0                        ; sub-unit of BAR on drive letter E:
  1301.          DD   <far addr of BAR device header>
  1302.          DB   1                        ; sub-unit of BAR on drive letter F:
  1303.          DD   <far addr of BAR device header>
  1304.  
  1305. Get Copyright File Name
  1306.  
  1307.      AX     1502h
  1308.      ES:BX  Transfer address; pointer to a 38 byte buffer
  1309.      CX     CD-ROM drive letter (A=0, B=1, ... Z=25)
  1310.  
  1311. MSCDEX will copy the name of the copyright file in the VTOC for that drive
  1312. letter into the buffer space provided. The copyright filename is presently
  1313. restricted in the High Sierra proposal to 8.3 but we require 38 bytes here
  1314. for the possibility at a later date of handling 31 character file names plus
  1315. 6 bytes for a ';' and 5 digit version number and 1 byte for a NULL at the
  1316. end. Carry will be set if the drive letter is not a CD-ROM drive and
  1317. error_invalid_drive (15) will be returned in AX.
  1318.  
  1319. Get Abstract File Name
  1320.  
  1321.      AX     1503h
  1322.      ES:BX  Transfer address; pointer to a 38 byte buffer
  1323.      CX     CD-ROM drive letter (A=0, B=1, ... Z=25)
  1324.  
  1325. MSCDEX will copy the name of the abstract file in the VTOC for that drive
  1326. letter into the buffer space provided. The abstract filename is presently
  1327. restricted in the High Sierra proposal to 8.3 but we require 38 bytes here
  1328. for the possibility at a later date of handling 31 character file names plus
  1329. 6 bytes for a ';' and 5 digit version number and 1 byte for a NULL at the
  1330. end. Carry will be set if the drive letter is not a CD-ROM drive and
  1331. error_invalid_drive (15) will be returned in AX.
  1332.  
  1333. Get Bibliographic Documentation File Name
  1334.  
  1335.      AX     1504h
  1336.      ES:BX  Transfer address; pointer to a 38 byte buffer
  1337.      CX     CD-ROM drive letter (A=0, B=1, ... Z=25)
  1338.  
  1339. ───────────────────────────────────────────────────────────────────────────
  1340. NOTE:
  1341.   This function is provided in advance of the ISO standard. For discs
  1342.   complying with the May 28th draft from the High Sierra Group, this
  1343.   function will return a null string as though the field is blank on the
  1344.   disc.
  1345. ───────────────────────────────────────────────────────────────────────────
  1346.  
  1347. MSCDEX will copy the name of the bibliographic documentation file in the
  1348. VTOC for that drive letter into the buffer space provided. The bibliographic
  1349. documentation filename is presently restricted in the High Sierra proposal
  1350. to 8.3 but we require 38 bytes here for the possibility at a later date of
  1351. handling 31 character file names plus 6 bytes for a ';' and 5 digit version
  1352. number and 1 byte for a NULL at the end. Carry will be set if the drive
  1353. letter is not a CD-ROM drive and error_invalid_drive (15) will be returned
  1354. in AX.
  1355.  
  1356. Read VTOC
  1357.  
  1358.      AX     1505h
  1359.      ES:BX  Transfer address; pointer to a 2048 byte buffer
  1360.      CX     CD-ROM Drive letter
  1361.      DX     Sector index
  1362.  
  1363. This function is provided to scan the Volume Descriptors on a disc. A sector
  1364. index of 0 will read the first volume descriptor, 1 reads the second, etc.
  1365. If there is no error, then AX will return 1 if the volume descriptor read
  1366. was the standard volume descriptor, 0FFh if it was the volume descriptor
  1367. terminator and there are no more volume descriptors to be read, and 0 for
  1368. all other types. 
  1369.  
  1370. If there is an error in processing the request, the Carry Flag will be set
  1371. and AL will contain the MS-DOS error code. These will be either
  1372. error_invalid_drive (15) or error_not_ready (21).
  1373.  
  1374. Turn Debugging On
  1375.  
  1376.      AX     1506h
  1377.      BX     Debugging function to enable
  1378.  
  1379. This is used for development and is reserved. It will be non-functional in
  1380. the production version of MSCDEX.
  1381.  
  1382. Turn Debugging Off
  1383.  
  1384.      AX     1507h
  1385.      BX     Debugging function to disable
  1386.  
  1387. This is used for development and is reserved. It will be non-functional in
  1388. the production version of MSCDEX.
  1389.  
  1390. Absolute Disk Read
  1391.  
  1392.      AX     1508h
  1393.      ES:BX  Disk Transfer Address; pointer to a buffer to copy data to
  1394.      CX     CD-ROM Drive letter (A=0, B=1, ... Z=25)
  1395.      DX     Number of sectors to read
  1396.      SI:DI  Starting sector
  1397.  
  1398. This function corresponds to INT 25h. It will be converted directly into a
  1399. READ_LONG device driver request and sent to the correct device driver. There
  1400. are no requirements for this call to pop flags as there are with INT 25h. SI
  1401. holds the high word and DI the low word for the starting sector to begin
  1402. reading from.
  1403.  
  1404. If there is an error in processing the request, the Carry Flag will be set
  1405. and AL will contain the MS-DOS error code. These will be either
  1406. error_invalid_drive (15) or error_not_ready (21).
  1407.  
  1408. Absolute Disk Write
  1409.  
  1410.      AX     1509h
  1411.      ES:BX  Disk Transfer Address; pointer to buffer to copy data from
  1412.      CX     CD-ROM Drive letter
  1413.      DX     Number of sectors to write
  1414.      SI:DI  Starting sector
  1415.  
  1416. This function corresponds to INT 26h. It is not supported at this time and
  1417. is reserved. It is intended to be used by authoring systems.
  1418.  
  1419. CD-ROM Drive Check
  1420.  
  1421.      AX     150Bh
  1422.      BX     Signature word
  1423.      CX     CD-ROM Drive letter (A=0, B=1,...Z=25)
  1424.  
  1425. This function returns whether or not a drive letter is a CD-ROM drive
  1426. supported by MSCDEX. If the extensions are installed, BX will be set to
  1427. ADADh. If the drive letter is supported by MSCDEX, then AX is set to a non-
  1428. zero value. AX is set to zero if the drive is not supported. One must be
  1429. sure to check the signature word to know that MSCDEX is installed and that
  1430. AX has not been modified by another INT 2Fh handler.
  1431.  
  1432. MSCDEX Version
  1433.  
  1434.      AX     150Ch
  1435.      BX     MSCDEX Version
  1436.  
  1437. This function returns the version number of the CD-ROM Extensions installed
  1438. on the system. BH contains the major version number and BL contains the
  1439. minor version. Values returned are binary. For example, BX would contain
  1440. 0x020a for version 2.10. This function does not work on versions earlier
  1441. than 2.00 so if BX is zero before and after this function is called, an
  1442. earlier version of MSCDEX is installed.
  1443.  
  1444. Get CD-ROM Drive Letters
  1445.  
  1446.      AX     150Dh
  1447.      ES:BX  Transfer address; pointer to buffer to copy drive letter
  1448.             device list
  1449.  
  1450. The buffer must be large enough to hold a list of drive letters. The buffer
  1451. size will be a multiple of the number of drives returned by the Get Number
  1452. of CD-ROM Drive Letters function. There are a maximum of 26 drive letters.
  1453. Each drive letter entry is a single byte (0=A:, 1=B: .. 25=Z:) that exactly
  1454. corresponds each respective entry returned by the command Get CD-ROM Drive
  1455. Device List. This command is included to allow applications to locate CD-ROM
  1456. drives supported by MSCDEX. CD-ROM drive letters may sometimes be
  1457. noncontiguous so this command is necessary.
  1458.  
  1459. For example: Suppose there is an installed CD-ROM device driver FOO
  1460. supporting 3 sub-units on a system with 2 floppy drives (A=0 and B=1), a
  1461. hard disk (C=2) and a network drive (E=4). Note the network drive occupies
  1462. one of the drive letters normally taken by a CD-ROM drive. MSCDEX assigns
  1463. that CD-ROM drive to the next available drive letter. Asking for the number
  1464. of CD-ROM drive letters reports there are 3 drive letters used starting at
  1465. drive letter D=3. ES:BX must point to a buffer that is at least 3 bytes long
  1466. and will be filled as follows:
  1467.  
  1468. ES:BX   = Buffer
  1469.  
  1470. Buffer  DB   3                   ; drive letter for CD-ROM (D=3)
  1471.         DB   5                   ; drive letter for CD-ROM (F=5)
  1472.         DB   6                   ; drive letter for CD-ROM (G=6)
  1473.  
  1474. Get/Set Volume Descriptor Preference
  1475.  
  1476.      AX     150Eh
  1477.      BX     0 - Get Preference. 1 - Set Preference
  1478.      CX     CD-ROM Drive letter (A=0, B=1,...Z=25)
  1479.      DX     if BX = Get Preference
  1480.                     DX = 0
  1481.                     MSCDEX will return preference settings in DX
  1482.             if BX = Set Preference
  1483.                     DH = volume descriptor preference
  1484.                          1 - PVD - Primary Volume  Descriptor
  1485.                          2 - SVD - Supplementary Volume Descriptor
  1486.                     DL = Supplementary Volume Descriptor Preference
  1487.                           if DH = PVD
  1488.                                   DL = 0
  1489.                           if DH = SVD
  1490.                                   1 - shift-Kanji (an unregistered ISO coded
  1491.                                                    character set)
  1492.  
  1493. Normally, MSCDEX will scan for the PVD (Primary Volume Descriptor) when
  1494. initializing a CD-ROM. This behavior can be altered for each individual
  1495. drive to scan for a SVD (Supplementary Volume Descriptor) instead. A CD-ROM
  1496. drive set to scan for an SVD will use the PVD if there is no SVD present.
  1497. There can be more than one SVD on a CD-ROM but at present, MSCDEX will only
  1498. recognize SVDs for shift-Kanji CD-ROMs. Carry will be set, AX will be set to
  1499. error_invalid_function (1) and DX will be set to 0 if the coded character
  1500. set is not recognized.
  1501.  
  1502. If BX contains Get_Preference, MSCDEX will report the present setting for
  1503. that drive. If DX is still zero on return, that version of MSCDEX does not
  1504. support this function or reading SVDs. Otherwise DX will contain the
  1505. setting.
  1506.  
  1507. If the drive letter is not a CD-ROM drive, carry will be set and
  1508. error_invalid_drive (15) will be returned in AX. If BX is anything other
  1509. than Get/Set_Preference, AX will be set to error_invalid_function (1) and
  1510. carry will be set.
  1511.  
  1512. Get Directory Entry
  1513.  
  1514.      AX     150Fh
  1515.      CX     CD-ROM Drive letter (A=0, B=1,...Z=25)
  1516.      ES:BX  Pointer to buffer with null-terminated path name
  1517.      SI:DI  Pointer to buffer to copy directory record information
  1518.      AX     0 is returned if the disc is High Sierra, 1 is returned if the
  1519.             disc is ISO-9660
  1520.  
  1521. The pathname expected is a null-terminated string e.g. char far *path =
  1522. "\\a\\b\\c.txt"; (note: the "\\" characters map to a single '\' character in
  1523. C so this would be '\a\b\c.txt' if printed). The path must consist only of
  1524. valid High Sierra or ISO-9660 filename characters and must not contain
  1525. any wildcards nor may it include entries for '.' or '..'.
  1526.  
  1527. The buffer to copy the directory record to can be a maximum of 255 bytes
  1528. long including all system use information. The directory record is a direct
  1529. copy from the directory file and it is up to the application to choose what
  1530. fields to use.
  1531.  
  1532. Carry will be set and an error code returned if there were problems with the
  1533. request. The error codes will be error_invalid_drive (15) if the drive
  1534. letter is incorrect, error_not_ready (21) if the disc didn't initialize
  1535. correctly, error_file_not_found (2) if the file was not found and
  1536. error_no_more_files (18) if the pattern fails to find a match or if mscdex
  1537. failed to allocate buffers.
  1538.  
  1539. The format of the directory record for High Sierra discs is:
  1540.  
  1541.      /* High Sierra directory entry structure */
  1542. typedef struct hsg_dir_entry {
  1543.     uchar      len_dr;        /* length of this directory entry  */
  1544.     uchar      XAR_len;       /* length of XAR in LBN's          */
  1545.     ulong      loc_extentI;   /* LBN of data Intel format        */
  1546.     ulong      loc_extentM;   /* LBN of data Molorola format     */
  1547.     ulong      data_lenI;     /* length of file Intel format     */
  1548.     ulong      data_lenM;     /* length of file Motorola format  */
  1549.     uchar      record_time[6];/* date and time                   */
  1550.     uchar      file_flags_hsg;/* 8 flags                         */
  1551.     uchar      reserved;      /* reserved field                  */
  1552.     uchar      il_size;       /* interleave size                 */
  1553.     uchar      il_skip;       /* interleave skip factor          */
  1554.     ushort     VSSNI;         /* volume set sequence num Intel   */
  1555.     ushort     VSSNM;         /* volume set sequence num Motorola*/
  1556.     uchar      len_fi;        /* length of name                  */
  1557.     uchar      file_id[...];  /* variable length name upto 32 chars       */
  1558.     uchar      padding;       /* optional padding if file_id is odd length*/
  1559.     uchar      sys_data[...]  /* variable length system data              */
  1560.     } hsg_dir_entry;
  1561.  
  1562. The format of the directory record for ISO-9660 discs is:
  1563.  
  1564.      /* ISO-9660 directory entry structure */
  1565. typedef struct iso_dir_entry {
  1566.     uchar      len_dr;        /* length of this directory entry  */
  1567.     uchar      XAR_len;       /* length of XAR in LBN's          */
  1568.     ulong      loc_extentI;   /* LBN of data Intel format        */
  1569.     ulong      loc_extentM;   /* LBN of data Molorola format     */
  1570.     ulong      data_lenI;     /* length of file Intel format     */
  1571.     ulong      data_lenM;     /* length of file Motorola format  */
  1572.     uchar      record_time[7];/* date and time                   */
  1573.     uchar      file_flags_iso;/* 8 flags                         */
  1574.     uchar      il_size;       /* interleave size                 */
  1575.     uchar      il_skip;       /* interleave skip factor          */
  1576.     ushort     VSSNI;         /* volume set sequence num Intel   */
  1577.     ushort     VSSNM;         /* volume set sequence num Motorola*/
  1578.     uchar      len_fi;        /* length of name                  */
  1579.     uchar      file_id[...];  /* variable length name upto 32 chars       */
  1580.     uchar      padding;       /* optional padding if file_id is odd length*/
  1581.     uchar      sys_data[...]  /* variable length system data              */
  1582.     } iso_dir_entry;
  1583.  
  1584. The difference between the two forms is the file flag byte moved to account
  1585. for an additional byte of date and time used for a Greenwich mean time
  1586. offset. See the May 28th draft of the High Sierra proposal or ISO-9660 for a
  1587. more complete explanation of the fields. Note that the C structs above are
  1588. not syntactically correct; C does not allow variable length arrays as struct
  1589. elements.
  1590.  
  1591. Send Device Driver Request
  1592.  
  1593.      AX     1510h
  1594.      CX     CD-ROM drive letter (A=0, B=1, ... Z=25)
  1595.      ES:BX  Address of CD-ROM device driver request header
  1596.  
  1597. This function has been added to simplify communication with CD-ROM drivers
  1598. and help prevent contention between applications that wish to communicate
  1599. with the device driver. It is highly recommended that all applications
  1600. communicate with device drivers through this function request. Applications
  1601. using this function will not have to locate the device driver. The format of
  1602. the request header is specified by the Microsoft MS-DOS CD-ROM Extensions
  1603. Hardware-Dependent Device Driver Specification.
  1604.  
  1605. ████████████████████████████████████████████████████████████████████████████
  1606.  
  1607. Networking CD-ROMS
  1608.  
  1609. Although it is possible to share CD-ROM drives on a local area network or
  1610. LAN, it is not as easy as it should be. While MS-DOS provides a single,
  1611. stable platform to develop a file system driver like the Microsoft CD-ROM
  1612. Extensions, there are a wide variety of LANs and LAN server implementations
  1613. that do not provide a stable platform for which a file system driver like
  1614. MSCDEX could be provided. Because each LAN implementation takes a different
  1615. approach for server support, the approach for CD-ROM support on a server
  1616. depends on what LAN implementation is being used.
  1617.  
  1618. This document should help clarify the present situation and help get you
  1619. started.
  1620.  
  1621. At present, there are several CD-ROM products that allow sharing of CD-ROM
  1622. drives on a LAN. LAN support may range from very simple and inexpensive to
  1623. not so simple and inexpensive. At present, there are three products
  1624. presently available that offer some form of LAN support. These are:
  1625.  
  1626.   Microsoft      MSCDEX - The Microsoft CD-ROM Extensions
  1627.   Meridian Data  CD-NET
  1628.   Online         Opti-Net
  1629.  
  1630. Choosing which product depends on your LAN and your needs. 
  1631.  
  1632. There are some LANs, such as Lantastic by Artisoft, that can share CD-ROM
  1633. drives using any version of MSCDEX on a Lantastic server. This is possible
  1634. because their servers run as an MS-DOS application and do I/O with standard
  1635. MS-DOS INT 21 services. LAN servers like this, that do not make assumptions
  1636. about the underlying media or try to bypass MS-DOS and do use standard MS-
  1637. DOS INT 21 services to access the drive letter, will likely work with all
  1638. versions of MSCDEX.
  1639.  
  1640. There are several LAN products based on MS-NET or a similar LAN server model
  1641. such as Ungermann-Bass or 3COM. Unfortunately, these products do not access
  1642. files on the server using standard INT 21 calls and for several reasons due
  1643. to assumptions inside MS-DOS about non-standard calls from the server, you
  1644. cannot share CD-ROM drives on MS-NET based servers. Although the server
  1645. seems to allow sharing of the CD-ROM drive letter, requests to the server
  1646. from workstations do not work correctly.
  1647.  
  1648. Fortunately, MSCDEX Version 2.10 has a command line switch (/S) that
  1649. instructs MSCDEX to patch the in-memory image of MS-DOS during its
  1650. initialization to fix these problems. By including this parameter on the
  1651. MSCDEX command line, MSCDEX can be loaded before the network server software
  1652. is started and the CD-ROM drive letters can then be shared by MS-NET based
  1653. server software and workstations will see the correct behavior. This
  1654. solution requires only that the server use MSCDEX Version 2.10 and no
  1655. software or hardware changes to the workstation. Only the server runs MSCDEX
  1656. or loads any CD-ROM related device drivers. To the workstation, the CD-ROM
  1657. server drives are indistinguishable from other server drives.
  1658.  
  1659. For LAN products that are not MS-NET based yet have NETBIOS support such as
  1660. Novell or IBM PC-NET, both Optinet and Meridian Data have adapted the MSCDEX
  1661. and CD-ROM Device Driver model to provide LAN CD-ROM support. Each
  1662. workstation runs MSCDEX and a special CD-ROM device driver that accepts
  1663. normal CD-ROM driver requests from MSCDEX and uses the NETBIOS to transmit
  1664. the command to a network driver on a server that submits the request to a
  1665. true CD-ROM device driver on the server and transmits the results back to
  1666. the workstation pseudo CD-ROM driver which in turn responds to MSCDEX. So
  1667. long as the workstation CD-ROM device driver responds appropriately, MSCDEX
  1668. is unaware that the command has passed through the network to a server.
  1669. Contact Meridian Data and Online for information for these networks as they
  1670. can both describe their products and features best.
  1671.  
  1672. Online offers one potential configuration for computer systems that do not
  1673. wish to dedicate a machine to be a server. The workstation operates as above
  1674. but instead of communicating the workstations driver request to a dedicated
  1675. server process, another user's workstation running a special TSR version of
  1676. their system can field the driver request, submit it to the CD-ROM driver,
  1677. and respond to the requesting workstation. This allows a network of
  1678. workstations to share the CD-ROM drives that each computer has connected to
  1679. it at the same time all workstations are available to the users. This option
  1680. does slow performance of the workstation when outside requests come in and
  1681. does use up valuable memory for the TSR system code but for some this option
  1682. may work.
  1683.  
  1684. At present, there is no available version of the CD-ROM Extensions for OS/2
  1685. although there is a way to access CD-ROM data in OS/2 on a network. Since
  1686. from the outside, workstations cannot tell MS-DOS server drives that are
  1687. shared CD-ROM drives using version 2.10 of MSCDEX from traditional block
  1688. drives, even OS/2 machines can access the CD-ROM drive on the server.
  1689. Although this does mean including an MS-DOS server on an OS/2 LAN, it does
  1690. provide at least an interim way to access CD-ROM data under OS/2 at this
  1691. time.
  1692.  
  1693. ████████████████████████████████████████████████████████████████████████████
  1694.  
  1695. Kanji Support
  1696.  
  1697. The Kanji support in MSCDEX presently recognizes High Sierra CD-ROM discs
  1698. with a coded character set that has bit 0 set to 1 in the volume flags
  1699. indicating at least one escape sequence is not registered according to ISO
  1700. 2375, and has an escape sequence of three bytes in the coded character set
  1701. for descriptor identifiers field of "$+:". This indicates that the character
  1702. set is a private multi-byte G3 coded character set and identifies the disc
  1703. as having shift-Kanji.
  1704.  
  1705. In order to make MSCDEX scan for the SVD (Supplementary Volume Descriptor)
  1706. instead of the PVD (Primary Volume Descriptor), there is a new command line
  1707. argument /K. If this is present, MSCDEX will use the shift-Kanji SVD if it
  1708. is present, otherwise it will use the PVD. All discs are required by ISO-
  1709. 9660 to have a PVD even if there is an SVD. 
  1710.  
  1711. In addition, there is an accompanying program SVD that can be used to change
  1712. the default preference each CD-ROM drive has for scanning for a SVD or PVD.
  1713. The syntax is:
  1714.  
  1715.   SVD [<drive letter>: <std  svd>]
  1716.  
  1717. Running SVD with no arguments will report the current settings. Including a
  1718. drive letter and either STD or SVD will change the preference for that drive
  1719. from one to the other.
  1720.  
  1721. ████████████████████████████████████████████████████████████████████████████
  1722.  
  1723. CD-ROMifying Your Software
  1724.  
  1725. CD-ROM is the first of what will probably be several alien file structures
  1726. that will start appearing in the MS-DOS world primarily with the
  1727. introduction of installable file systems under newer versions of DOS. The
  1728. following will attempt to outline some guidelines for writing software that
  1729. will help in porting your software to these new file systems and for CD-ROM
  1730. specifically.
  1731.  
  1732.  
  1733. Choice of Filename Characters
  1734.  
  1735. On the first Microsoft Test CD-ROM disc, the Codeview demo failed because
  1736. certain filename characters that were legal on MS-DOS were not allowed
  1737. according to the High Sierra file format. When the software looked for file
  1738. 'S1.@@@', it wasn't found because the character '@' is illegal for High
  1739. Sierra filenames and during High Sierra premastering, the file was renamed
  1740. 'S1'.
  1741.  
  1742. Valid High Sierra filename characters are the letters 'A' through 'Z', the
  1743. digits '0' through '9', and the underscore character '_'. All other
  1744. characters are invalid. Note that the letters 'a' through 'z' are not
  1745. included so that High Sierra file names are not case sensitive. Under DOS,
  1746. filenames are mapped to upper case before they are looked up so this is
  1747. typically not a problem. When choosing file name characters, keep in mind
  1748. the restrictions of the file structure format and the operating systems your
  1749. media may be targeted towards.
  1750.  
  1751.  
  1752. Depth of Path
  1753.  
  1754. The High Sierra format allows for pathnames to be up to 8 levels deep. It's
  1755. possible to create a path on MS-DOS that is deeper than that but you won't
  1756. be able to transfer it to a CD-ROM.
  1757.  
  1758.   \one\two\three\four\five\six\seven\eight\file.txt /* Ok */
  1759.   \one\two\three\four\five\six\seven\eight\nine\file.txt /* Illegal */
  1760.  
  1761.  
  1762. Length of Path
  1763.  
  1764. The High Sierra format allows for the entire pathname to be a maximum of 255
  1765. characters. Since MS-DOS imposes a limit far lower than this, this should
  1766. not present a problem. The MS-DOS call to connect to a sub-directory is
  1767. limited to a directory string of 64 characters. The length of path
  1768. restriction is more a concern for Xenix/Unix than MS-DOS.
  1769.  
  1770. Amusingly enough, the MS-DOS call to create a sub-directory allows a
  1771. directory string greater than 64 characters which allows you to create sub-
  1772. directories that you cannot connect to.
  1773.  
  1774. Unfortunately, a CD-ROM may potentially contain a pathname that is much
  1775. larger than 64 characters long. This is not a concern here but is discussed
  1776. in a related memo - "MS-DOSifying your CD-ROM". As a rule, try to keep the
  1777. length of your longest path less than 64 characters and you should be pretty
  1778. safe.
  1779.  
  1780.  
  1781. Read-only
  1782.  
  1783. Even though most people understand that CD-ROM discs are read-only, there's
  1784. still a lot of software written by these same people that assumes the
  1785. current disk is always writable. For example, the Microsoft Multiplan Demo
  1786. assumes that it can create and write temporary files to the presently
  1787. connected drive.
  1788.  
  1789. In order to avoid this problem, try to provide another means of letting the
  1790. user specify where temporary files can be created. Many applications check
  1791. the environment for the variables TMP or TEMP which contain the pathname to
  1792. use when creating temp files. Most people understand this convention now (or
  1793. should anyway) and an added benefit will be the speed improvement that will
  1794. be recognized if the temp directory is located on a ram-drive. If the
  1795. environment variable is not set, then the application can fall back on the
  1796. assumption that the media is writable or ask where temporary files should be
  1797. kept.
  1798.  
  1799. As a rule, for both temporary and permanent files, if a file creation error
  1800. occurs, allow the user to re-specify the pathname used so that he can work
  1801. around the error. The last thing that should happen is for work to be lost
  1802. because the user was not allowed to store his output in a valid place.
  1803.  
  1804.  
  1805. Non-DOS Formatted Disks
  1806.  
  1807. Don't depend on the format of data on the disk. CD-ROM's do not have a FAT
  1808. so don't even bother looking for one. Do not talk to any media at a physical
  1809. level (reading/writing sectors) unless you expect to be media dependent
  1810. (such as CHKDSK or FORMAT). MS-DOS INT 21h calls should provide everything
  1811. you need to get at the file contents and attributes.
  1812.  
  1813.  
  1814. Small Directories
  1815.  
  1816. For performance reasons, try to keep directory sizes smaller than about 40
  1817. or so. Much beyond this and directory files grow beyond one 2048 byte
  1818. sector. Typically this is not a problem but if the number of sector buffers
  1819. chosen when MSCDEX is started is small and the directory files are large,
  1820. whatever software scanning the directory could potentially thrash badly if
  1821. every time the directory is searched for the next entry it has to bring
  1822. earlier directory sectors back into memory from the CD-ROM drive.
  1823.  
  1824. For certain pathological programs, such as certain implementations of the
  1825. Xenix utility find, the penalty is about 1 second per directory sector that
  1826. you have to scan to get to the next entry. If the directory is large, say 8
  1827. sectors, the time for FIND to scan that one directory could potentially take
  1828. a half hour for something that would take less than a second if all the
  1829. entries fit in the cache.
  1830.  
  1831. The solution for this problem is to make sure that MSCDEX never throws out
  1832. of the cache what it will need next. This is accomplished by growing the
  1833. cache (very easy - simply change the parameter to MSCDEX) and to make sure
  1834. that the largest object that goes through the cache will not clear it out.
  1835. There is a balance between having too many directories and too many files in
  1836. a few directories but the balance is heavily weighted towards many small to
  1837. medium sized directories. Keep this in mind when laying out your files.
  1838.  
  1839. Since the penalty for using a file in the lowest sub-directory instead of
  1840. the root-directory is virtually nil and as more directories don't cost much,
  1841. it's a good idea to break up large directories into several smaller ones.
  1842. This will help avoid problems of flushing the disc sector cache. Try to keep
  1843. related files close together both in location on the CD-ROM and in the same
  1844. directories. Close proximity will reduce seek time when accessing related
  1845. files at the same time and having them in the same directory will help
  1846. prevent swapping out directory sectors.
  1847.  
  1848.  
  1849. Updating CD-ROM Databases and Software
  1850.  
  1851. Many people are interested in providing updates to files that are contained
  1852. on a CD-ROM disc. They would like to create a directory on their hard disk
  1853. with all updated files in them and have the CD-ROM Extensions look there
  1854. first before searching the CD-ROM. Unfortunately, by the time the Extensions
  1855. get the request, it is very difficult for it to look for updates on the hard
  1856. disk so whatever alternative searching that is necessary will have to be
  1857. done in the application software.
  1858.  
  1859. For this reason, it's a good idea to have your path set so that it looks
  1860. through directories on the hard disk first. Another good strategy is to copy
  1861. executables to a directory on your hard disk so that they can be updated and
  1862. will also start up faster. Also, have the application software itself search
  1863. alternative hard disk directories for updates before it searches the CD-ROM.
  1864. This way both software updates and updated or commonly used database files
  1865. can be stored on a hard disk which will both speed performance and allow
  1866. incremental updating.
  1867.  
  1868.  
  1869. Search Strategies
  1870.  
  1871. Try to avoid relying on the operating system to be part of your search
  1872. strategy. If your database is broken up into a hierarchy and your order is
  1873. imposed through the file structure by breaking up the database into many
  1874. files in a tree, then accessing data in the database is typically going to
  1875. require a lot of directory reading and searching.
  1876.  
  1877. Usually the time involved in doing this on a hard disk is not large but on a
  1878. CD-ROM, the search times can add up. Opening a file can be an expensive
  1879. operation simply because the directory must be read before the file can be
  1880. opened. At best, seeking to a location on the CD-ROM can take 10 msec or so;
  1881. at worst, a seek can run to over a second on some older CD-ROM drives. Some
  1882. newer drives have worst case seek of about half a second. Whenever this can
  1883. be avoided you will save time. MSCDEX caches as many directory sectors as it
  1884. can so that searching the most active directories is very quick but any
  1885. operations that search multiple directories once through continually clears
  1886. out the cache and renders it ineffective.
  1887.  
  1888. The strategy used by Microsoft Bookshelf was to lump the entire database
  1889. into a single file and structure the indexing so that searching used a
  1890. minimum of seeks. Bookshelf uses packed b-trees with each node holding as
  1891. many entries as will fit into a single sector and also cache in memory as
  1892. much of the root of the tree as it can.
  1893.  
  1894. Combining databases avoids the extra overhead of repeatedly opening and
  1895. closing database files. Caching as much of the indexes in memory as possible
  1896. allows searching of keywords to be completed typically with a single seek.
  1897.  
  1898. In general, identify your software bottlenecks and through judicious use of
  1899. faster storage media (either memory or hard disk) you can both have large
  1900. storage and respectable performance.
  1901.  
  1902.  
  1903. Portability
  1904.  
  1905. One of the advantages of the High Sierra format is data interchangeability
  1906. with other operating systems. One must take care to chose a subset of the
  1907. range of High Sierra features that are presently supported across different
  1908. operating systems to be sure you can read the disc in each of them. The
  1909. lowest common denominator then (this list is not complete - see also what
  1910. must be done to target MS-DOS) would need a logical block size of 512 bytes,
  1911. both type L and M path tables and for all fields, single volume sets, at
  1912. least one primary volume descriptor and terminator. Be aware that if one of
  1913. your goals is data portability, you will have to do some additional research
  1914. to see what restrictions on the High Sierra format other operating systems
  1915. may impose.
  1916.  
  1917. ████████████████████████████████████████████████████████████████████████████
  1918.  
  1919. MS-DOSifying Your CD-ROM
  1920.  
  1921. Most of the following caveats apply to the present version of the Microsoft
  1922. CD-ROM Extensions. Future versions of the extensions are expected to support
  1923. many of the features listed below that are at present best avoided. The
  1924. behavior of the extensions with fields and records that are presently
  1925. ignored may change at any time.
  1926.  
  1927. Correctness
  1928.  
  1929. Make sure that your disc is in valid High Sierra format. Nothing is
  1930. guaranteed if your disc is not in valid format. Surprisingly enough, we have
  1931. received several discs that have one or more illegally formatted data areas
  1932. ranging from directories being sorted incorrectly, incorrect path table
  1933. sizes, incorrect directory file sizes, directories missing from the path
  1934. table, invalid directory names, etc. In almost every case, the Extensions
  1935. will behave incorrectly and at worst, the system will crash.
  1936.  
  1937. In addition to running validation software to verify the High Sierra image,
  1938. one should also verify that the Extensions work with your CD-ROM disc and
  1939. application software before distributing it. Unfortunately, it may not
  1940. matter if your disc is correct and the Extensions are wrong if they don't
  1941. work together. Please report any and all problems you think are in the
  1942. Extensions to Microsoft so that they can be fixed. 
  1943.  
  1944. Pathtable and Directory Sizes
  1945.  
  1946. This bears repeating because many people have gotten it wrong. Directory
  1947. file sizes are always a multiple of the logical sector size - 2 kilobytes.
  1948. Path table sizes are always the exact number of bytes that are contained in
  1949. the path table which is typically not a multiple of 2k. You must not have
  1950. blank directory sectors and the directory length must reflect the correct
  1951. length of the directory file. The directory sectors always begin on a
  1952. logical sector boundary.
  1953.  
  1954. 8.3 File Names
  1955.  
  1956. MS-DOS cannot handle longer than 8.3 filenames. If the CD-ROM filename is
  1957. longer than 8.3, then the filename will be truncated. If this happens, two
  1958. files that are not unique within 8.3 characters will map to the same
  1959. filename. For example:
  1960.  
  1961.   filename1.txt will appear as filename.txt
  1962.   filename2.txt will also appear as filename.txt
  1963.  
  1964. Kanji filenames are also limited to 8.3 or 4.1 kanji characters. Only shift-
  1965. kanji filenames are recognized at present. To get kanji, you must specify a
  1966. supplementary volume descriptor indicating you have kanji filenames. Contact
  1967. Microsoft to find out how this is done.
  1968.  
  1969. Record Formats
  1970.  
  1971. The extensions do not support any record formats so if the RECORD bit is set
  1972. in the file flags byte in the directory entry for a file, it will be
  1973. ignored.
  1974.  
  1975. Interleaving
  1976.  
  1977. In the present version, the Extensions do not support interleaving so if the
  1978. Interleave size and Interleave factor are non-zero, the file will ignore
  1979. these fields and return erroneous data.
  1980.  
  1981. Multi-Extent Files
  1982.  
  1983. Multi-extent files are not supported in the present version. Each extent of
  1984. a multi-extent file will appear as a separate file with the same name.
  1985.  
  1986. Multi-Volume
  1987.  
  1988. Multi-volume disc sets are not supported in the present version. Directories
  1989. that are located on another volume could potentially cause the Extensions to
  1990. crash if searched and erroneous data will be returned for files that are
  1991. located on another volume.
  1992.  
  1993. Coded Character Sets
  1994.  
  1995. Only one coded character set or supplementary volume descriptor is
  1996. recognized in the latest version. This is for shift-Kanji.
  1997.  
  1998. Version Numbers
  1999.  
  2000. Version numbers are not supported by the Extensions. The Extensions will
  2001. strip the version string off the end of the filename so that two identical
  2002. filenames with different versions will appear to have the same name. There
  2003. is no way to specifically ask for any but the first instance of that
  2004. filename. Two files with the same name and different version numbers have
  2005. the same accessing problem as two files with longer than 8.3 filenames that
  2006. have been truncated to the same filename.
  2007.  
  2008. Protection
  2009.  
  2010. Protection bits are not used on MS-DOS. If the protection bit is set in the
  2011. file flags byte in the directory entry for a file though, the file will not
  2012. show up on any search or open even if the protection bits in the XAR are set
  2013. to allow all access.
  2014.  
  2015. No XAR Support
  2016.  
  2017. At present, the Extensions ignore the contents of any XAR record.
  2018.  
  2019. Motorola Format Tables
  2020.  
  2021. The additional copies of the path table and any values in "Motorola" format
  2022. (most significant bytes using the lowest address values) are ignored at
  2023. present. MSCDEX only pays attention to "Intel" formatted values. They should
  2024. be included though for portability sake.
  2025.  
  2026. Multiple Copies of the Path Table
  2027.  
  2028. The Extensions presently only read and use the first copy of the path table.
  2029. Later versions may check to see that copies of the path table agree.
  2030.  
  2031. Additional Volume Descriptor Records
  2032.  
  2033. Boot records and Unspecified volume descriptors are ignored. The first
  2034. standard volume descriptor found is the one that is used. Additional copies
  2035. are ignored at present.
  2036.  
  2037. File Flags
  2038.  
  2039. The existence bit is treated the same as the hidden bit on MS-DOS. Some
  2040. other operating systems may not handle the existence bit so you may not want
  2041. to use it if you are targeting these systems. The directory bit for High
  2042. Sierra is treated the same as the directory bit in MS-DOS. Files with the
  2043. protection bit set are not found when searched for or opened.
  2044.  
  2045. None of the remaining bits, (Associated/Record/Multi-extent/Reserved), are
  2046. handled at present. Using files with these bits set will have undefined
  2047. behavior.
  2048.  
  2049. Unique Volume Identifiers
  2050.  
  2051. It is highly recommended that the volume identifier be unique. The
  2052. Extensions use the volume identifier to do volume tracking and to double-
  2053. check to see if the disc has changed. The more chance that users will have
  2054. two discs with the same volume identifier, the more chance that this will
  2055. confuse the Extensions and lead it to believe that the disc has not changed
  2056. when in fact it has.
  2057.  
  2058. It is also highly recommended that application programs use the volume label
  2059. to tell if the CD-ROM disc has changed. The volume label for a CD-ROM on MS-
  2060. DOS is obtained from the volume identifier field in the primary volume
  2061. descriptor. The call to get the volume label is very inexpensive to make
  2062. once the CD-ROM has been initialized and will cause no disc I/O to be done
  2063. unless the media has changed. This is the best way for an application to
  2064. tell if the disc it wants to work with is in the drive. The application
  2065. software should not communicate with the driver or drive to determine if the
  2066. media has changed or the Extensions may not learn that the disc has changed
  2067. and will not reinitialize what it knows about the new disc.
  2068.  
  2069. Many Small Directories or A Few Large Directories
  2070.  
  2071. As a rule, it is better to have many small directories that contain fewer
  2072. files than one very large directory. The answer depends on your
  2073. application's behavior because if you try very hard, you can thrash almost
  2074. as badly with many small subdirectories as you can with one large
  2075. subdirectory. Reading further will help explain.
  2076.  
  2077. What makes the difference? For each file open, suppose you have 1000
  2078. subdirectories with 40 files, on average you'll read about one sector per
  2079. file open and scan 1/2 of it. On the other hand, you could have 1 directory
  2080. with 4000 files. On average, each file open in this large directory (about
  2081. 100 sectors) will involve scanning about 50 sectors to open that one file.
  2082. As long as it is very inexpensive to get to each directory through the
  2083. pathtable, clearly it is much better to have many small directories.
  2084.  
  2085. Further improvements can be made by grouping files that are related and will
  2086. be opened together in each of these subdirectories so that as you open each
  2087. successive file, the directory sector is very likely in the disc cache and
  2088. this will help minimize hitting the CD-ROM disc.  Putting each file in a
  2089. separate subdirectory is extreme and will cost you because you will never
  2090. gain the benefits of locating the next file in a directory sector that has
  2091. already been cached and you will needlessly enlarge the pathtable.
  2092.  
  2093. There is a limit though to how many subdirectories you may want because if
  2094. there are too many you may end up thrashing on the pathtable sectors. Each
  2095. pathtable sector holds pointers to approximately 100 to 200 directory files
  2096. depending on the directory name lengths. If you have a pathtable that is 10
  2097. sectors long, you will want at least 10 sectors of memory buffers to hold
  2098. the pathtable or you may risk re-reading sections of the pathtable on every
  2099. file open which will be very costly.
  2100.  
  2101. The most important point you can learn is that you can vastly improve your
  2102. file open speed by making sure you have enough memory buffers. If you are
  2103. repeatedly trying to scan a 10 sector directory file (approximately 400
  2104. entries) and you only have 4 sectors in the sector cache, the cache is going
  2105. to work against you because you will end up churning it to death. If you
  2106. allocate 14 sectors for example (/M:14), then the whole directory file will
  2107. find its way into the cache and you will stop hitting the disc. The
  2108. difference in speed may be several orders of magnitude. A safe bet is to
  2109. recommend reserving as many sectors are in the pathtable plus the number of
  2110. sectors for the largest directory plus 2. The last two are reserved for data
  2111. sectors and internal dynamic data. This formula is complicated with multiple
  2112. drives because the buffers are not tied to specific drives and are shared
  2113. and because not all drives are active at the same time.
  2114.  
  2115. Another rule, do not rely on the file system to do your searching for you.
  2116. If you are performance conscious, finding a chunk of data by looking for it
  2117. with a file name through the file system is expensive if speed is a great
  2118. concern. 99% of the time, locating data through the file system is fine
  2119. because the cost is a single one time operation but if this is repeated
  2120. often enough, it may pay to do some of the work yourself. What can be better
  2121. is lump everything into one big file and cache your own hierarchy, indexing,
  2122. binary trees, or whatever searching scheme you choose to use to get you to
  2123. the data you need rather than asking for the file system to tell you where
  2124. it is.
  2125.  
  2126. ████████████████████████████████████████████████████████████████████████████
  2127.  
  2128. Questions and Answers
  2129.  
  2130. Q: Does the /V option to MSCDEX actually cause a message to be displayed? I
  2131. can't make it do anything. I use:
  2132.  
  2133.   MSCDEX /D:CDDRV /V /M:8
  2134.  
  2135. A: Yes, a series of statistics are displayed. MSCDEX uses INT 10 function
  2136. 0eH to write to the console so if for some reason you are trapping this or
  2137. have software that captures this and doesn't display bios output to the
  2138. screen the information will not appear. All screen output uses this function
  2139. so if any output appears on the screen after loading MSCDEX, It is not clear
  2140. why this additional information does not appear.
  2141.  
  2142. Newer versions (2.0 and above) use the DOS write handle call for output
  2143. which will fix problems of I/O redirection of this output.
  2144.  
  2145. As it turned out, the machine that had this problem was not a strict IBM
  2146. compatible machine and did not emulate a PC at the BIOS level. Consequently,
  2147. the messages written with INT 10h were not displayed.
  2148.  
  2149. Q: Is it normal for MSCDEX to hang the system if an error is returned by a
  2150. driver's IOCTL function? Wouldn't an error message be better?
  2151.  
  2152. A: The only ioctl calls sent to the driver in version 1.01 are to request
  2153. the device header address and media check. Media check calls will never hang
  2154. no matter what is returned so long as the driver returns. Illegal values may
  2155. not do what you want but it won't hang. Request device header address may
  2156. hang if the driver fails to set error conditions correctly as DOS expects
  2157. them as DOS will return from my ioctl call without error. MSCDEX will then
  2158. assume the bogus return values are correct and jump to a random location.
  2159.  
  2160. Q: Does MSCDEX do anything that should preclude its working in a non-IBM-
  2161. clone machine?
  2162.  
  2163. A: Except for the INT 10 problem mentioned earlier, no. If you can identify
  2164. any problems whatsoever, we would be happy to learn about it but as yet, we
  2165. have heard of no other problems. If your machine runs MS-DOS version 3.X,
  2166. it should be capable of running the extensions correctly. As for
  2167. driver/drive-controller compatability problems, that may be another matter.
  2168. We do not guarantee anything about these because we do not write the device
  2169. drivers or design the hardware interface boards and cannot make any claims
  2170. concerning them. It is up to the drive manufacturer or device driver writer
  2171. to do this kind of compatability testing.
  2172.  
  2173. Q: Based on what I read in the spec, I decided to support only HSG type
  2174. addressing which seems to be allowed by the IOCTLI function #6 (Device
  2175. Status). I return 4 bytes of 00h if that function is called. I would have
  2176. thought that would be one of the first calls MSCDEX would make (after "Find
  2177. Header") but so far it hasn't called the status function. How will MSCDEX
  2178. know enough not to use Red Book addressing if it doesn't check status
  2179. first?
  2180.  
  2181. A: In version 1.01, ioctl function #6 is not called. This is not to say that
  2182. in a future versions it will not (in fact it will). Since all device drivers
  2183. must support some default functionality and as MSCDEX only uses the basic
  2184. default now (only High Sierra addressing for example), it wasn't a problem
  2185. that it didn't call this function to find out about non-default features
  2186. that were supported.
  2187.  
  2188. Some software is being written that controls audio on a CD-ROM that expects
  2189. Red Book Addressing and checks the device status to see that it is
  2190. supported. The conversion algorithms are fairly simple and code fragments
  2191. are provided.
  2192.  
  2193. Q: Can you provide more info on how the READ/WRITE device control string
  2194. should work. Does the read device bytes command get information that was
  2195. written by the write device control string?
  2196.  
  2197. A: As of yet, no one to our knowledge has used this. There are a couple
  2198. other features of which this can be said. Again, this is not to say that
  2199. they won't be used at some later time.
  2200.  
  2201. The purpose of these commands was to allow a standard way of delivering
  2202. commands that were not specified in the CD-ROM device driver spec to the
  2203. drive. For example, sending SCSI command strings and reading the responses
  2204. from the drive. This function is deliberately open-ended and vague because
  2205. it was intended to provide a catch-all mechanism for application programs to
  2206. communicate requests or request data in ways that were not specified by the
  2207. device driver spec. For application programs to use these functions they
  2208. have to know the driver supports these functions and also how to communicate
  2209. with that specific drive. The mechanism would let the driver do what it does
  2210. best and worry about which ports and interrupts to use. This relieves the
  2211. application program from these details and allow it to deal with controlling
  2212. the device at a higher level.
  2213.  
  2214. Right now, if the driver does not support these functions, it should
  2215. return an error for Unknown Command. One could test whether these two
  2216. function were supported this way.
  2217.  
  2218. ───────────────────────────────────────────────────────────────────────────
  2219. Note:
  2220.   If there are commands which you feel should be supported by the device
  2221.   driver specification, please communicate them to us and we will consider
  2222.   adding them if they are of sufficient general interest.
  2223. ───────────────────────────────────────────────────────────────────────────
  2224.  
  2225. Q: The version of MSCDEX I am using is 1.01 dated 3/20/87@11:06am and is
  2226. marked Evaluation Copy. Is this any less functional than a "licensed" copy?
  2227.  
  2228. A: No. There may be a few more bug fixes in the licensed copy that are not
  2229. in the Evaluation copy but none that should prevent correct operation. If
  2230. you do find any bugs, please let us know as we will fix any bugs in the
  2231. software that are reported. Our policy is to try to reward users that report
  2232. bugs with updates of the software that fix their problem.
  2233.  
  2234. Q: Would it be possible for me to get a sample source file for a driver?
  2235.  
  2236. A: Yes. Licensees are given source code to device drivers for:
  2237.  
  2238.      SONY    - complete
  2239.  
  2240.      HITACHI - missing two modules. These are owned by Hitachi so we
  2241.                cannot supply them, though Hitachi will.
  2242.  
  2243.      PHILIPS - this driver communicates with the Philips CD-ROM driver 
  2244.                supplied by Philips.
  2245.  
  2246. Q: How can an application access CD-ROM drives that are subunits of one
  2247. driver? The IOCTL calls do not take an argument for subunit. MSCDEX seems to
  2248. handle this OK since when I do a directory of each CD-ROM in turn it
  2249. accesses the correct drive. I do not see any clean way for an application
  2250. to, for example lock the door on CD-ROM drive G: which is the third drive
  2251. handled by the driver.
  2252.  
  2253. A: Requests all have a sub-unit field in the request header. Commands that
  2254. one would expect to be directed to a specific drive, such as open door, are
  2255. targeted at a particular drive through the use of the sub-unit field.
  2256.  
  2257. Q: What is the current release version number of MSCDEX? The version I have
  2258. is version 1.01 that is marked EVALUATION COPY. When can I get a final
  2259. release version of it? Also will that final version include the changes to
  2260. do all I/O through MSDOS (i.e. no INT 10h).
  2261.  
  2262. A: The most recent released version is version 2.0. You can purchase this
  2263. from a number of licensees including all drive manufacturers. An Extensions
  2264. availability list is attached.
  2265.  
  2266. Q: Why doesn't MSCDEX allow IOCTL access via the drive letter (i.e. DOS
  2267. func. 44h subfunc. #4,5), as if the CD-ROM were a drive. I understand that
  2268. the driver is not a block device, but this is being handled already in some
  2269. way since you allow a user to perform file I/O to a CD-ROM making it appear
  2270. to be a block device. It would seem that all that would be necessary to
  2271. accomplish this is to intercept IOCTL calls in the same way that file access
  2272. calls are being intercepted.
  2273.  
  2274. A: MSCDEX doesn't presently hook int 21h, which is what this would involve.
  2275. It's doubtful that this will change. It's not that much more difficult to
  2276. open the file and send an IOCTL to the handle. File access calls are not
  2277. caught at an INT 21h level but are caught from within DOS at another
  2278. interface. CD-ROM drives are far more like network drives than traditional
  2279. MS-DOS FAT file structure block drives and their drivers. For example, try
  2280. to FORMAT a CD-ROM drive and you'll see. Part of all this prevents IOCTL's
  2281. to the drive letter from being directed to the appropriate driver.
  2282.  
  2283. Q: Why not allow access to the PLAY, STOP and SEEK functions via the INT 2Fh
  2284. entry point as is allowed for READ LONG. This would be much simpler than
  2285. requiring the application to locate the driver header and then find the
  2286. STRATEGY entry point and create request control blocks etc. This is a lot of
  2287. code to start the music playing!
  2288.  
  2289. A: It's preferable to see MS-DOS provide extensions to the application
  2290. program interface for audio/video control (new int 21h calls). The reason we
  2291. haven't included play, etc. in the int 2Fh interface is to avoid loading
  2292. down MSCDEX with additional functionality that most people don't use. Your
  2293. suggestion would only move that code from the CD-playing program into
  2294. MSCDEX. It makes your program smaller, but in the whole, doesn't buy much.
  2295. As time goes on, this may change and some of the functionality may move into
  2296. the int 2Fh interface.
  2297.  
  2298. Q: Shouldn't the specification eliminate the need for the application to
  2299. OPEN the driver by name, This is especially important in systems where the
  2300. driver creates a new driver header for each CD-ROM drive. MSDOS allows so
  2301. few file handles to be simultaneously open as it is that requiring
  2302. applications to open even more is very bad.
  2303.  
  2304. A: Simply close the driver handle after you have located the device header.
  2305. You no longer need to communicate through DOS to control it, so free the
  2306. handle and make it available for other programs to use. With version 2.10,
  2307. it is no longer necessary to OPEN the device driver in order to communicate
  2308. with it. Applications can communicate with the device driver using Send
  2309. Device Driver Request.
  2310.  
  2311. Q: Have you considered adding an addressing mode for the PLAY AUDIO function
  2312. that would allow the application to specify the PLAY address by TNO instead
  2313. of block number or min/sec/frame?
  2314.  
  2315. A: This has been considered but has not been added to keep from complicating
  2316. the device drivers unnecessarily. At the moment, most CD-ROM drives are used
  2317. without audio so our intent was to put what was needed for audio support in
  2318. the audio playing software. In addition, we chose to keep the interface
  2319. simple to leave more latitude for changes to the OS/2 API that may include
  2320. newer data types like audio and video. Nonetheless, this may be added in the
  2321. future. In the meantime, audio playing software has the extra overhead of
  2322. reading the audio table of contents and interpreting the tracks itself.
  2323.  
  2324. Q: Why is there no CLOSE TRAY function in the driver spec? The CD-ROM drive
  2325. we are using (Toshiba SCSI) has this capability but I see no way to use it
  2326. via the extensions. Why allow the user to OPEN it without allowing him to
  2327. close it?
  2328.  
  2329. A: A close tray command has been added.
  2330.  
  2331. Q: It seems that there should be bits in the Device Status word to indicate
  2332. whether a driver supports Reading/Writing device control strings.
  2333.  
  2334. A: Reading and writing device control strings was put it in as a catch-all
  2335. for anything that was missed so that application programs could send
  2336. specific commands through the device driver to the device if they understood
  2337. the device and knew how to communicate to it. A manufacturers CD-ROM
  2338. diagnostic program would be an example of a program that might choose to
  2339. communicate with the drive in this way. If the driver does not support these
  2340. functions, it should return an error. One can test whether these two
  2341. function are supported by testing if the error returned is for Unknown
  2342. Command. 
  2343.  
  2344. Q: In the spec, treatment of the BUSY bit in the status word with regard to
  2345. the PLAY AUDIO function seems to assume only one CD-ROM drive. What happens
  2346. when the user has two or more drives each of which want to be playing music?
  2347. How does the application tell whether the desired drive is busy? It would
  2348. seem better to use some of the bits in the upper word of Device Status to
  2349. indicate BUSY for each drive. Perhaps allowing 8 or 16 drives.
  2350.  
  2351. A: Requests all have sub-unit numbers associated with them. A request for
  2352. service from one sub-unit may report that the drive is busy at the same time
  2353. another sub-unit was not busy. The sub-unit field is used to distinguish
  2354. requests between the drives supported by the driver. The busy bit serves as
  2355. an indication of drive status for the sub-unit the request is for.
  2356.  
  2357. Q: If a CD-ROM file is opened in write-only mode, no error occurs.
  2358.  
  2359. A: True. The same happens on a floppy drive with a write-protect tab on it.
  2360. If you do have a handle to a CD-ROM file in open_for_write mode, as soon as
  2361. you attempt to write, you will get an error. The correct model is to
  2362. duplicate the behavior of a file that has been set READ-ONLY. Read-only
  2363. files return error_access_denied if you try to open them in open_for_write
  2364. or open_for_both modes. MSCDEX has been changed to duplicate this behavior.
  2365.  
  2366. Q: What other non-MSDOS calls are issued by MSCDEX besides INT 10h?
  2367.  
  2368. A: INT 2Fh - dos callbacks
  2369.    INT 67h - expanded memory
  2370.    INT 10h - all INT 10h calls went away with version 2.00 which uses DOS
  2371.              write handle instead.
  2372.  
  2373. Q: Why does MSCDEX do the READ LONG PREFETCH call after it has done a DEVICE
  2374. CLOSE call? Is this intentional?
  2375.  
  2376. A: MSCDEX version 1.X never issued device open or close. These were issued
  2377. by DOS as part of driver initialization. MSCDEX version 2.00 now issues
  2378. device open calls and will precede the prefetch call.
  2379.  
  2380. Q: In the device driver spec, it says that if more than one unit is
  2381. supported by the driver that this field should be set to the number of
  2382. units. I suspect that this is wrong since this is not a block device. As far
  2383. as I can see, this field should only ever be set to one since each unit will
  2384. actually have its own header with its own unique name.
  2385.  
  2386. A: CD-ROM device drivers are a hybrid of block and char device drivers and
  2387. are not technically legal as one or the other. Block drivers make some
  2388. assumptions about the media format that aren't meaningful for CD-ROM and
  2389. don't have a read call that can deal with CD-ROM's large data space. They
  2390. were made as char devices with some additional calls and rules. One of the
  2391. changes that was made for CD-ROM device drivers was to allow multiple sub-
  2392. units for the device so the treatment of this field is correct as specified
  2393. even though CD-ROM device drivers are character device drivers.
  2394.  
  2395. If one has more than one CD-ROM drive, one can approach supporting them
  2396. from several ways. One could have separate device drivers for each drive and
  2397. load one per drive, have a single driver with multiple device headers, or
  2398. have a single driver with one device header that supports sub-units. This
  2399. last method is borrowed from block drivers. For the case that the drives and
  2400. drive commands are all the same, using sub-units will allow you to
  2401. distinguish between which drive receives which command. The alternatives
  2402. clutter things up with drivers or device headers. Sub-units may not be legal
  2403. character device driver fields but conceptually, they're the right thing.
  2404. Since CD-ROM device drivers could not be block drivers and had to be char
  2405. device drivers, some liberties were taken with the specification to merge
  2406. the best of both specifications.
  2407.  
  2408. Q: Is there any support through MSCDEX for WRITE LONG? I have a need for
  2409. this to support a CD mastering system. I would like to be able to treat a
  2410. WORM drive as a CD-ROM and allow writing to the drive once to create a
  2411. master and then be able to test it out by using it as CD-ROM to verify that
  2412. our data has been correctly stored in "High Sierra" format.
  2413.  
  2414. A: Such a call exists. It only serves to define a standard interface for CD-
  2415. ROM device drivers that are running over re-writable media──such as a CD
  2416. mastering system. It is in the latest copy of the driver spec released with
  2417. version 2.00 of the CD-ROM Extensions.
  2418.  
  2419. Q: How important is it that I should support RAW mode access in my driver?
  2420. What would this typically be used for?
  2421.  
  2422. A: Not important now. No drive presently support reading raw at the moment
  2423. that we know of. Since drives and their command capabilities are hardware
  2424. dependent, you would know based on the capabilities of your hardware if you
  2425. wanted to support it. This function was added for completeness. A standard
  2426. way was needed to define how to get at the 288 bytes of EDC/ECC if drives
  2427. allowed access and to have an avenue prepared if people found useful
  2428. applications that would not use EDC/ECC where they wanted the additional
  2429. space (such as gracefully degrading low-fidelity audio or graphics). It will
  2430. be useful for copying audio information or for audio systems that will want
  2431. to be able to manipulate audio tracks. Many people have expressed interest
  2432. in having this capability.
  2433.  
  2434. Q: Driver spec page 13 (in the structure for the UPC Code function): "The
  2435. UPC/EAN code (last 4 bits are zero)". Does this mean the low order or high
  2436. order 4 bits?
  2437.  
  2438. A: This is less ambiguous if you read Red Book under mode-2 of the Q-channel
  2439. info. This is now clarified in the UPC Code call. It should be the low
  2440. nibble of byte 7. Red Book specifies that MSB comes out first so the high
  2441. nibble will contain the 13th nibble of the UPC code and the 14th nibble will
  2442. be zero.
  2443.  
  2444. Unfortunately, scanning for the UPC code is time consuming especially if
  2445. it is done by the software. This is due to the design of the q-channel in
  2446. Red Book. It's a pity because this could be a useful number to verify the
  2447. correct disc has been inserted. Most CD-ROMs do not have a UPC code or have
  2448. it zeroed out. The same seems to be true for CD-audio as well. We believe
  2449. that CD-ROM drives should scan for the UPC code as they read the Table of
  2450. Contents when initializing from power up or a new disc. If the hardware does
  2451. not do this, the UPC code has to be scanned by polling the q-channel which
  2452. may occasionally miss the UPC code.
  2453.  
  2454. Q: It would be nice if the device driver spec included a list of what types
  2455. of disk access functions would and would not work so that users could get an
  2456. idea of what utilities and applications will and will not work with the
  2457. extensions.
  2458.  
  2459. A: The device driver specification describes just what is necessary for
  2460. writing a CD-ROM device driver. The information you would like concerning
  2461. things such as INT 25h/26h not supported as well as the behavior
  2462. CHKDSK/FORMAT/etc belongs and is mentioned in the MSCDEX overview.
  2463.  
  2464. Q: If I have a low priority request and if the system has time, can the
  2465. prefetch request read into and transfer the data into a transfer address?
  2466.  
  2467. A: We have looked at this for some time but the bottom line is that
  2468. asynchronous I/O under DOS is virtually impossible to support in all cases.
  2469. Because of this it is unlikely we will be implementing this or designing it
  2470. into the device driver interface. There is no way for MSCDEX or the CD-ROM
  2471. device driver to know that the transfer address is still valid because DOS
  2472. never notifies MSCDEX or the device driver if the requesting process was
  2473. been terminated. The request runs the risk of writing over another program.
  2474. The best approach now is if the driver wants to, it can reserve internal
  2475. buffer space for data from the disc and put prefetched data there. Then it
  2476. can copy the data to the read transfer address once the read request finally
  2477. arrives. Alternately, some of the caching or prefetching can reside in the
  2478. CD-ROM controller or in the drive itself. True asynchronous reads will have
  2479. to wait for OS/2.
  2480.  
  2481. Q: Is there any status indication that the transfer has occurred? or some
  2482. interaction with the read long command?
  2483.  
  2484. A: There is no way to tell if a prefetch request was successful or the state
  2485. of it. The prefetch simply provides a hint and the read request later is the
  2486. request that finally expects delivery of the data.
  2487.  
  2488. Q: Read (ioctl input) When audio is playing, can location of head move?
  2489.  
  2490. A: I'm not entirely sure what you mean by this question but I will attempt
  2491. to answer a couple different ways and hope I provide the information you
  2492. need.
  2493.  
  2494. While audio is playing, the head is moving on the CD. If the driver
  2495. receives a command asking where the head is, the driver should ask the drive
  2496. where the head is presently positioned and report that. So as audio is
  2497. playing, an application program that is controlling the audio can monitor
  2498. the progress of audio playback and can either synchronize actions with the
  2499. audio or report the present location to the user. For example, a program to
  2500. play audio discs would be able to report the present track number and time
  2501. elapsed on the computer monitor much like a CD-audio player reports things
  2502. on its LED display. If the driver is sent a command that requires the
  2503. movement of the head or a change in the state of the machine (SEEK, READ,
  2504. INITIALIZE, PLAY AUDIO etc.) then the audio will be interrupted so that the
  2505. drive can perform the new request. If the drive receives a command for
  2506. status or some other function that does not require the head to be moved or
  2507. the state of the machine to change, then audio play should continue.
  2508.  
  2509. Q: Are the parameters of Audio Disk Info and Audio Track Info BCD or
  2510. binary?
  2511.  
  2512. A: The parameters were vaguely specified in the device driver spec. The spec
  2513. has been clarified. They are as follows:
  2514.  
  2515.   ■  Audio Disk Info
  2516.           binary    Lowest Track Number (1-99)
  2517.           binary    Highest Track Number (1-99)
  2518.           red book  Starting point of lead-out track
  2519.  
  2520.   ■  Audio Track Info
  2521.           binary    Track Number (1-99)
  2522.           red book  Starting point of track
  2523.           as is     Track control information
  2524.  
  2525. The track control information is not a BCD or Binary number like the track
  2526. number. The byte contents as it appears on the disc should be carried
  2527. through unmodified by the driver and is interpreted according to the
  2528. Philips/Sony Red Book standard.
  2529.  
  2530. Q: Are the parameters for the Audio Q-channel info BCD or binary?
  2531.  
  2532. A: The parameters are as follows:
  2533.  
  2534.   ■  Audio Q-Channel Info
  2535.           as is     Control and ADDR byte
  2536.           as is     Track Number
  2537.           as is     Point or Index (X)
  2538.  
  2539.           red book  MIN/SEC/FRAME
  2540.           zero      ZERO
  2541.           red book  AMIN/ASEC/AFRAME or PMIN/PSEC/PFRAME
  2542.  
  2543. The notes on when to convert from BCD to red book addresses for
  2544. MIN/SEC/FRAME, AMIN/ASEC/AFRAME and PMIN/PSEC/PFRAME is already fairly clear
  2545. in the spec. The other fields are passed through as is from the disc. For
  2546. additional information, see the two code samples AUDIO.C and AUDIO.ASM.
  2547.  
  2548. Q: Must we support read sub-channel info and the read upc code?
  2549.  
  2550. A: No. It is not necessary that these be supported. At the present time and
  2551. in the forseeable future, MSCDEX will not be issuing these commands though
  2552. some applications may wish to.
  2553.  
  2554. Read Sub-Channel Information
  2555. At the present time, nobody is using channels P or R through W. The read
  2556. sub-channel command was added to provide a standard way to specify access to
  2557. these channels in the event that they are used and to specify in one way or
  2558. another access to all information on a CD-ROM. The error detection or
  2559. correction for information in these channels is not as good as it is for
  2560. data returned from READ commands.
  2561.  
  2562. Read UPC Code
  2563. This command is conceivably much more useful. It is advised that it be
  2564. supported so that application software can exactly identify the CD-ROM in
  2565. the drive. This may be a consideration for audio software that wishes to try
  2566. to identify inserted audio discs (if the UPC code is present) or for
  2567. software that is specifically tied to a version of a CD-ROM. Unfortunately,
  2568. the standard does not specify a specific location for this information so
  2569. that unless the hardware reads it on disc initialization as we recommend,
  2570. the device driver must poll the q-channel and hope that it locates it. See
  2571. also the sample code in AUDIO.ASM.
  2572.  
  2573. Q: My driver seems to work ok except that whenever I connect to a sub-
  2574. directory and do a directory, I am suddenly back in the root directory
  2575. again. What's going wrong?
  2576.  
  2577. A: What is most likely happening is the driver is returning an incorrect
  2578. value for MEDIA CHECK and MSCDEX thinks that the disc is changing all the
  2579. time. When this happens, MSCDEX rereads the volume descriptors and pathtable
  2580. and reinitializes what it knows about the disc and changes the current
  2581. working directory back to root as if the drawer had been opened, the disc
  2582. removed, and then reinserted. This will be accompanied with a larger amount
  2583. of disc activity than one would expect for a simple directory scan. Fixing
  2584. the driver to return the correct value when asked for a media check will
  2585. correct this behavior.
  2586.  
  2587. Q: What is the best way for my application to know if the disc has changed
  2588. since it was last accessed?
  2589.  
  2590. A: Use the DOS function find first and look for the volume id. When the disc
  2591. has been read and MSCDEX has already initialized the internal information it
  2592. keeps for each disc, this is a relatively inexpensive operation. The
  2593. information is in memory and the disc does not have to be touched, so
  2594. checking the volume id is very quick. Only if the disc has been changed does
  2595. the disc have to be touched. This operation takes considerably longer than
  2596. if the disc was not changed but even so, this has to be done anyway because
  2597. MSCDEX has to read and initialize what it knows about the new disc so it can
  2598. report the volume id correctly so the application can know if the disc in
  2599. the drive is the one that it is looking for.
  2600.  
  2601. Q: When I do a directory, the first couple filenames are either duplicated
  2602. or they are random characters. What might cause this?
  2603.  
  2604. A: The problem comes from having the incorrect bytes in the file identifier
  2605. field for the first two directory entries. The first directory entry in each
  2606. directory file is supposed begin with a copy of the directory record for
  2607. that directory file followed by a copy of the directory record for the
  2608. parent directory (also known as '.' and '..' on Unix or MS-DOS). The
  2609. filename or directory identifier is supposed to be 1 byte long
  2610.  
  2611. Q: When I do a directory, the first couple filenames are either duplicated
  2612. or they are random characters. What might cause this?
  2613.  
  2614. A: The problem comes from having the incorrect bytes in the file identifier
  2615. field for the first two directory entries. The first directory entry in each
  2616. directory file is supposed begin with a copy of the directory record for
  2617. that directory file followed by a copy of the directory record for the
  2618. parent directory (also known as '.' and '..' on Unix or MS-DOS). The
  2619. filename or directory identifier is supposed to be 1 byte long and the
  2620. contents are supposed to be 0 for the first directory entry and 1 for the
  2621. second directory entry. This is discussed in clause 6.8.2.2 of the ECMA
  2622. standard or the ISO-9660 proposal. Several places on the disc in question,
  2623. you have a 1 where there should be a 0 and in one directory, the file
  2624. identifier consists of 0x8A which is why DIR in that directory begins with
  2625. an "e". Incorrectly formatted discs will not be handled by the extensions
  2626. correctly. This is why it is a good idea to test your disc image using
  2627. MSCDEX before you press a disc to make sure your data is formatted correctly
  2628. and as MSCDEX expects it.
  2629.  
  2630. Q: I have a directory file that is 4Kb long but when I do a DIR in that
  2631. directory, it is slower than usual and random filenames are printed out. I
  2632. can tell by watching the device driver commands that MSCDEX is asking for
  2633. sectors far beyond the end of the directory. I can see how this might
  2634. account for the random filenames but why is it scanning so far?
  2635.  
  2636. A: Problems such as this result from having with multi-sector directory
  2637. files that include empty sectors in the directory file. The High Sierra
  2638. specification does not allow you to have empty directory sectors at the end
  2639. or to have gaps in the middle. The problem stems from the fact that your
  2640. directory length is too long. For example, for the disc in question, the
  2641. root directory begins at sector 28 and its length is 4096 bytes but the
  2642. second sector is completely blank (all 0's). This confuses MSCDEX because it
  2643. does not expect to see empty sectors.
  2644.  
  2645. Because LEN_DR of what would be the first directory entry in sector 29 is
  2646. 0, MSCDEX thinks that there are no more entries in that sector. When it
  2647. reaches the end of the entries in each sector, MSCDEX rounds its offset up
  2648. to the start of the next sector:
  2649.  
  2650.   offset += (SECTOR_SIZE - 1);
  2651.   offset &= ~(SECTOR_SIZE - 1);
  2652.  
  2653. Since the offset did not changed when scanning sector 29 (there were no
  2654. entries in this sector to increment the offset) the above rounding algorithm
  2655. does not change the offset (2048 in, 2048 out). This is why MSCDEX continues
  2656. reading beyond the end of the directory file at sector 29 because the offset
  2657. did not grow past the directory length. MSCDEX continues reading blank
  2658. sectors (sectors 29 through 49 are all blank) until it reaches the first
  2659. non-blank sector.
  2660.  
  2661. It looks like what you are attempting to do is implement updatable High
  2662. Sierra and you want to allocate the directory space ahead of time and fill
  2663. it in later as needed. The format you are using though is not valid High
  2664. Sierra and also incurs the cost of reading the blank directory sectors at
  2665. the end of every directory. Instead, you should record the correct High
  2666. Sierra directory length in the directory length field for that directory (in
  2667. this case 2Kb). What remains is finding a place to store the value which
  2668. tells how many blocks have been reserved for each directory file. There are
  2669. a number of places this can be done, either in system/application use fields
  2670. in the directory record, in an XAR, or in a separate file either inside or
  2671. outside the High Sierra directory structure. The first is the easiest
  2672. approach to take.
  2673.  
  2674. Be aware thought that CDI may have plans to use the system use field in the
  2675. directory record so you may want to investigate Philips' plans to make sure
  2676. whatever scheme you use meshes well with what CDI has in mind. MSCDEX will
  2677. ignore the system use or application use information recorded so you can
  2678. store what you'd like in the form you like (ascii or binary). You may also
  2679. want a final pass over the directory hierarchy before mastering to remove
  2680. extraneous information from the directory record.
  2681.  
  2682. Q: I noticed that Function Request 0 Get Number of CD-ROM Drive Letters may
  2683. not always return unambiguous results. Suppose I start the network first and
  2684. use one of the drive letters for a network drive (F:). When I start the
  2685. Extensions, it will begin assigning drive letters after the last used drive
  2686. letter (C: on my machine). If I have 4 CD-ROM drives on my system, they
  2687. will be assigned drive letters D:, E:, G:, and H:. Function 0 returns 4 in
  2688. BX for the number of CD-ROM drives and 3 in CX for drive letter D:
  2689. correctly. But as you can see, the CD-ROM drives do not use contiguous drive
  2690. letters so I cannot deduce from what this function returns that drive F: is
  2691. not a CD-ROM drive.
  2692.  
  2693. A: That is correct. This is why function 0Dh Get CD-ROM drive letters was
  2694. added. To get an unambiguous list of CD-ROM drives, use this function or use
  2695. function 0Bh CD-ROM Drive Check to tell if a drive letter is for a CD-ROM
  2696. drive.
  2697.  
  2698. Q: Is it possible to do an absolute read using the Extensions. I am trying
  2699. to read mode 2 (uncooked) data using Function Request 8 Absolute Read. I use
  2700. a normal device I/O to turn off error correction and perform a read but all
  2701. I get back is 2048 bytes of data instead of the full 2356 bytes. Is there
  2702. another way in Int 2F to get the data uncooked?
  2703.  
  2704. A: Not at present. If you want to get at the data including error correction
  2705. code, you will have to communicate directly with the device driver. The
  2706. Extensions will provide the location of the device drivers if asked.
  2707.  
  2708. Q: Is it possible to access a non-High Sierra disc with the Extensions using
  2709. an absolute disc read?
  2710.  
  2711. A: One can use either the extensions to read a non-High Sierra disc using
  2712. INT 2Fh or one can communicate directly with the device driver to do this.
  2713. The device driver itself makes no distinction between High Sierra and non-
  2714. High Sierra discs so it can be used to read them although the burden of file
  2715. system translation and reading then falls on the application talking to the
  2716. driver. The INT 2Fh Absolute Read function simply packages the request to
  2717. read and sends it directly to the driver and returns the result.
  2718.  
  2719. Q: What we have done is, in AUTOEXEC.BAT, first loaded the MS-DOS CD-ROM
  2720. extensions and then the MS-NET software. The error message is "Redirector
  2721. already installed". The network software is then not loaded. We are using
  2722. MS-NET 1.1 in an HP product called ThinLAN. Any hints as to what they should
  2723. try next?
  2724.  
  2725. A: MSCDEX is a CD-ROM "redirector". It hooks into DOS the same way the
  2726. network redirector does to get requests for file access to files that are
  2727. not on local hard/floppy disks. As far as DOS is concerned, CD-ROM drives
  2728. look just like network drives. DOS passes all file accesses through the
  2729. redirector interface to the network redirector which in turn sends file
  2730. access requests out over the net. MSCDEX splices itself in front of the
  2731. network redirector and takes requests belonging to CD-ROM drives and passes
  2732. the rest to the network redirector.
  2733.  
  2734. The problem is that the network redirector code assumes that there will only
  2735. be one redirector installed (itself) whereas MSCDEX does not make this
  2736. assumption. If the network redirector is installed after MSCDEX (before it
  2737. in the interrupt chain), it will process all requests from DOS and never
  2738. pass any CD-ROM requests through to MSCDEX. For this reason, MSCDEX has to
  2739. be installed after the network redirector (before it in the interrupt chain)
  2740. and so MSCDEX prevents the network redirector from installing afterwards to
  2741. ensure this. Since you installed MSCDEX first, the network believes a
  2742. redirector is already installed so it does not install itself which is what
  2743. you are seeing. In order to install both, simply install your network
  2744. software first and MSCDEX second and you're set.
  2745.  
  2746. Q: CHKDSK, ASSIGN, and SUBST report that the CD-ROM is a network disc. Why
  2747. is this?
  2748.  
  2749. A: From the above explanation, you understand that to DOS, the CD-ROM drives
  2750. look like network drives. The programs CHKDSK, ASSIGN, and SUBST check the
  2751. same fields DOS does and think the same thing. There is no way to get around
  2752. this.
  2753.  
  2754. Q: RENAME gives error message "Duplicate file name or File not found"
  2755. instead of something that makes sense such as "Access denied" or "Can't
  2756. rename CD-ROM files".
  2757.  
  2758. A: The error message is coming from the code for RENAME and not MSCDEX. The
  2759. error condition is being returned correctly but the error code returned by
  2760. version 1.01 is correct according to DOS documentation. The problem seems to
  2761. be that there are two error codes for access denied - 5 and a special one 65
  2762. which is error_net_access_denied which is returned by the network redirector
  2763. when it has a problem. MSCDEX version 2.00 returns error code
  2764. error_net_access_denied and so RENAME now reports "Access denied".
  2765.  
  2766.  
  2767.  
  2768.